summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/util
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-27 20:37:41 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-27 20:37:41 +0000
commit66e4eb3c01053c6642804a4f8e188bd05aab4790 (patch)
treefe227c6799230954c48cd70db60d05eae63cbe44 /chrome/browser/sync/util
parenta3ed6c82468f9f704a1b7e112ea3c132adb5ea2e (diff)
downloadchromium_src-66e4eb3c01053c6642804a4f8e188bd05aab4790.zip
chromium_src-66e4eb3c01053c6642804a4f8e188bd05aab4790.tar.gz
chromium_src-66e4eb3c01053c6642804a4f8e188bd05aab4790.tar.bz2
Unrevert again r63919: "Part 2 of immutable Extension refactor."
(Last landing broke chromeos and chromium linux builder.) I made Extension a refcounted object, and privitized the existing con/destructor and InitFromValue. The only way to get an Extension is to call a factory method. In the next CL, I plan to make the factory method return a const Extension, to guarantee that no one can modify the Extension object after creation. Note: There was a tricky part of this CL because of the difference in semantics between scoped_ptr and scoped_refptr. I had to be careful not to use ptr.release(), since that would result in leaks (an un-Released AddRef). BUG=56558 TEST=no functional change Original Review URL: http://codereview.chromium.org/3982001 TBR=aa Review URL: http://codereview.chromium.org/4119010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/util')
-rw-r--r--chrome/browser/sync/util/extensions_activity_monitor_unittest.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc b/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
index cffa963..d5f88d4 100644
--- a/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
+++ b/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
@@ -53,7 +53,7 @@ class BookmarkAPIEventTask : public Task {
done_->Signal();
}
private:
- scoped_ptr<Extension> extension_;
+ scoped_refptr<Extension> extension_;
scoped_refptr<FunctionType> function_;
size_t repeats_;
base::WaitableEvent* done_;
@@ -68,13 +68,12 @@ class BookmarkAPIEventGenerator {
template <class T>
void NewEvent(const FilePath::StringType& extension_path,
T* bookmarks_function, size_t repeats) {
- FilePath path(extension_path);
- Extension* extension = new Extension(path);
std::string error;
DictionaryValue input;
input.SetString(keys::kVersion, kTestExtensionVersion);
input.SetString(keys::kName, kTestExtensionName);
- extension->InitFromValue(input, false, &error);
+ scoped_refptr<Extension> extension(Extension::Create(
+ FilePath(extension_path), Extension::INVALID, input, false, &error));
bookmarks_function->set_name(T::function_name());
base::WaitableEvent done_event(false, false);
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
@@ -128,14 +127,13 @@ class ExtensionsActivityMonitorTest : public testing::Test {
static std::string GetExtensionIdForPath(
const FilePath::StringType& extension_path) {
std::string error;
- FilePath path(extension_path);
- Extension e(path);
DictionaryValue input;
input.SetString(keys::kVersion, kTestExtensionVersion);
input.SetString(keys::kName, kTestExtensionName);
- e.InitFromValue(input, false, &error);
+ scoped_refptr<Extension> extension(Extension::Create(
+ FilePath(extension_path), Extension::INVALID, input, false, &error));
EXPECT_EQ("", error);
- return e.id();
+ return extension->id();
}
private:
NotificationService* service_;