Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: webkit/support/test_webkit_platform_support.cc

Issue 12093086: Avoid leaking TestWebIDBFactory instances, and reset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/support/test_webkit_platform_support.h ('k') | webkit/support/webkit_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/support/test_webkit_platform_support.h" 5 #include "webkit/support/test_webkit_platform_support.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/metrics/stats_counters.h" 9 #include "base/metrics/stats_counters.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (!factory_) 398 if (!factory_)
399 factory_.reset(WebKit::WebIDBFactory::create()); 399 factory_.reset(WebKit::WebIDBFactory::create());
400 } 400 }
401 401
402 scoped_ptr<WebIDBFactory> factory_; 402 scoped_ptr<WebIDBFactory> factory_;
403 base::ScopedTempDir indexed_db_dir_; 403 base::ScopedTempDir indexed_db_dir_;
404 WebString data_dir_; 404 WebString data_dir_;
405 }; 405 };
406 406
407 WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() { 407 WebKit::WebIDBFactory* TestWebKitPlatformSupport::idbFactory() {
408 return new TestWebIDBFactory(); 408 if (!idb_factory_)
409 idb_factory_.reset(new TestWebIDBFactory());
410 return idb_factory_.get();
409 } 411 }
410 412
411 #if defined(OS_WIN) || defined(OS_MACOSX) 413 #if defined(OS_WIN) || defined(OS_MACOSX)
412 void TestWebKitPlatformSupport::SetThemeEngine(WebKit::WebThemeEngine* engine) { 414 void TestWebKitPlatformSupport::SetThemeEngine(WebKit::WebThemeEngine* engine) {
413 active_theme_engine_ = engine ? 415 active_theme_engine_ = engine ?
414 engine : WebKitPlatformSupportImpl::themeEngine(); 416 engine : WebKitPlatformSupportImpl::themeEngine();
415 } 417 }
416 418
417 WebKit::WebThemeEngine* TestWebKitPlatformSupport::themeEngine() { 419 WebKit::WebThemeEngine* TestWebKitPlatformSupport::themeEngine() {
418 return active_theme_engine_; 420 return active_theme_engine_;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 return 0; 606 return 0;
605 } 607 }
606 608
607 WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve( 609 WebKit::WebGestureCurve* TestWebKitPlatformSupport::createFlingAnimationCurve(
608 int device_source, 610 int device_source,
609 const WebKit::WebFloatPoint& velocity, 611 const WebKit::WebFloatPoint& velocity,
610 const WebKit::WebSize& cumulative_scroll) { 612 const WebKit::WebSize& cumulative_scroll) {
611 // Caller will retain and release. 613 // Caller will retain and release.
612 return new WebGestureCurveMock(velocity, cumulative_scroll); 614 return new WebGestureCurveMock(velocity, cumulative_scroll);
613 } 615 }
616
617 void TestWebKitPlatformSupport::ResetIDBFactory() {
618 idb_factory_.reset();
619 }
OLDNEW
« no previous file with comments | « webkit/support/test_webkit_platform_support.h ('k') | webkit/support/webkit_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698