summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-31 21:32:03 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-31 21:32:03 +0000
commit4fc8394c26a3eb86ff7c8c7aa7bc25c7759eb6fe (patch)
tree455ff4ed351ed95c8f26e6dc1254fc487098bcac /webkit
parent677cf5ffcfaca3eeb11e96c339a9dfb1c29df57c (diff)
downloadchromium_src-4fc8394c26a3eb86ff7c8c7aa7bc25c7759eb6fe.zip
chromium_src-4fc8394c26a3eb86ff7c8c7aa7bc25c7759eb6fe.tar.gz
chromium_src-4fc8394c26a3eb86ff7c8c7aa7bc25c7759eb6fe.tar.bz2
Avoid leaking TestWebIDBFactory instances, and reset
the TestWebIDBFactory instance between layout tests. (The last part depends on a WebKit patch to actually call ResetTestEnvironment.) R=jsbell@chromium.org Review URL: https://chromiumcodereview.appspot.com/12093086 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/support/test_webkit_platform_support.cc8
-rw-r--r--webkit/support/test_webkit_platform_support.h3
-rw-r--r--webkit/support/webkit_support.cc4
3 files changed, 13 insertions, 2 deletions
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc
index a6cf5a9..291260d 100644
--- a/webkit/support/test_webkit_platform_support.cc
+++ b/webkit/support/test_webkit_platform_support.cc
@@ -405,7 +405,9 @@ class TestWebIDBFactory : public WebKit::WebIDBFactory {
};
WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() {
- return new TestWebIDBFactory();
+ if (!idb_factory_)
+ idb_factory_.reset(new TestWebIDBFactory());
+ return idb_factory_.get();
}
#if defined(OS_WIN) || defined(OS_MACOSX)
@@ -611,3 +613,7 @@ WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve(
// Caller will retain and release.
return new WebGestureCurveMock(velocity, cumulative_scroll);
}
+
+void TestWebKitPlatformSupport::ResetIDBFactory() {
+ idb_factory_.reset();
+}
diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h
index 6e2dc6e..a004ce0 100644
--- a/webkit/support/test_webkit_platform_support.h
+++ b/webkit/support/test_webkit_platform_support.h
@@ -137,6 +137,8 @@ class TestWebKitPlatformSupport :
const WebKit::WebFloatPoint& velocity,
const WebKit::WebSize& cumulative_scroll);
+ void ResetIDBFactory();
+
private:
TestShellWebMimeRegistryImpl mime_registry_;
MockWebClipboardImpl mock_clipboard_;
@@ -154,6 +156,7 @@ class TestWebKitPlatformSupport :
WebKit::WebGamepads gamepad_data_;
WebKit::Platform* shadow_platform_delegate_;
HyphenDict* hyphen_dictionary_;
+ scoped_ptr<WebKit::WebIDBFactory> idb_factory_;
#if defined(OS_WIN) || defined(OS_MACOSX)
WebKit::WebThemeEngine* active_theme_engine_;
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc
index 9e376272..32c576f 100644
--- a/webkit/support/webkit_support.cc
+++ b/webkit/support/webkit_support.cc
@@ -192,7 +192,9 @@ class TestEnvironment {
#if defined(OS_ANDROID)
media_player_manager_->ReleaseMediaResources();
#endif
- WebKit::setIDBFactory(webkit_platform_support_->idbFactory());
+ webkit_platform_support_->ResetIDBFactory();
+ // TODO(darin): Uncomment this once DRT calls ResetTestEnvironment().
+ //WebKit::setIDBFactory(webkit_platform_support_->idbFactory());
}
TestWebKitPlatformSupport* webkit_platform_support() const {