diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 20:09:16 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-02 20:09:16 +0000 |
commit | aa9d4a9eab291ef35d6aed3fb390e0c7a76c8cc1 (patch) | |
tree | 94f7eb2d1e1277ab0a52fb9594b86c652af12acd /chrome/browser/history | |
parent | 83421477bc9698c3f0c9de41764eb85dfc162ba7 (diff) | |
download | chromium_src-aa9d4a9eab291ef35d6aed3fb390e0c7a76c8cc1.zip chromium_src-aa9d4a9eab291ef35d6aed3fb390e0c7a76c8cc1.tar.gz chromium_src-aa9d4a9eab291ef35d6aed3fb390e0c7a76c8cc1.tar.bz2 |
Adds the --enable-in-memory-url-index switch to gate creation and use of the InMemoryURLIndex.
BUG=19736
TEST=No change in behavior when flag is not used. Should not crash when flag is used.
Review URL: http://codereview.chromium.org/2861041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51555 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/in_memory_history_backend.cc | 15 | ||||
-rw-r--r-- | chrome/browser/history/in_memory_history_backend.h | 11 |
2 files changed, 23 insertions, 3 deletions
diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc index d40c581..9f3e7be 100644 --- a/chrome/browser/history/in_memory_history_backend.cc +++ b/chrome/browser/history/in_memory_history_backend.cc @@ -1,13 +1,16 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/history/in_memory_history_backend.h" +#include "base/command_line.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/history/history_notifications.h" #include "chrome/browser/history/in_memory_database.h" +#include "chrome/browser/history/in_memory_url_index.h" #include "chrome/browser/profile.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" namespace history { @@ -25,7 +28,15 @@ InMemoryHistoryBackend::~InMemoryHistoryBackend() { bool InMemoryHistoryBackend::Init(const FilePath& history_filename) { db_.reset(new InMemoryDatabase); - return db_->InitFromDisk(history_filename); + bool success = db_->InitFromDisk(history_filename); + + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableInMemoryURLIndex)) { + index_.reset(new InMemoryURLIndex); + // TODO(rohitrao): Load index. + } + + return success; } void InMemoryHistoryBackend::AttachToHistoryService(Profile* profile) { diff --git a/chrome/browser/history/in_memory_history_backend.h b/chrome/browser/history/in_memory_history_backend.h index 18184bf..30026b5 100644 --- a/chrome/browser/history/in_memory_history_backend.h +++ b/chrome/browser/history/in_memory_history_backend.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,6 +27,7 @@ class Profile; namespace history { class InMemoryDatabase; +class InMemoryURLIndex; struct URLsDeletedDetails; struct URLsModifiedDetails; @@ -50,6 +51,12 @@ class InMemoryHistoryBackend : public NotificationObserver { return db_.get(); } + // Returns the in memory index owned by this backend. This index is only + // loaded when the --enable-in-memory-url-index flag is used. + InMemoryURLIndex* index() const { + return index_.get(); + } + // Notification callback. virtual void Observe(NotificationType type, const NotificationSource& source, @@ -68,6 +75,8 @@ class InMemoryHistoryBackend : public NotificationObserver { scoped_ptr<InMemoryDatabase> db_; + scoped_ptr<InMemoryURLIndex> index_; + // The profile that this object is attached. May be NULL before // initialization. Profile* profile_; |