summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi
diff options
context:
space:
mode:
authorericu@chromium.org <ericu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-04 02:29:17 +0000
committerericu@chromium.org <ericu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-04 02:29:17 +0000
commitfe939ae4e80a657a3fdd55132fa572ce678c1eef (patch)
tree608d25dbe204602f988033d004c73dde25c6df13 /webkit/fileapi
parentb47815f17b42a73d3da78364bd10b501450db00b (diff)
downloadchromium_src-fe939ae4e80a657a3fdd55132fa572ce678c1eef.zip
chromium_src-fe939ae4e80a657a3fdd55132fa572ce678c1eef.tar.gz
chromium_src-fe939ae4e80a657a3fdd55132fa572ce678c1eef.tar.bz2
Proper fix for a leak problem previously hacked around in
http://codereview.chromium.org/7086020/. BUG=none TEST=heapchecker stays happy Review URL: http://codereview.chromium.org/7112018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi')
-rw-r--r--webkit/fileapi/file_system_dir_url_request_job_unittest.cc12
-rw-r--r--webkit/fileapi/file_system_url_request_job_unittest.cc17
2 files changed, 13 insertions, 16 deletions
diff --git a/webkit/fileapi/file_system_dir_url_request_job_unittest.cc b/webkit/fileapi/file_system_dir_url_request_job_unittest.cc
index 10783eb..b913466 100644
--- a/webkit/fileapi/file_system_dir_url_request_job_unittest.cc
+++ b/webkit/fileapi/file_system_dir_url_request_job_unittest.cc
@@ -92,9 +92,6 @@ class FileSystemDirURLRequestJobTest : public testing::Test {
request_.reset(NULL);
delegate_.reset(NULL);
- // This shouldn't be necessary, but it shuts HeapChecker up.
- file_system_context_ = NULL;
-
net::URLRequest::RegisterProtocolFactory("filesystem", NULL);
}
@@ -156,15 +153,18 @@ class FileSystemDirURLRequestJobTest : public testing::Test {
return temp;
}
+ // Put the message loop at the top, so that it's the last thing deleted.
+ MessageLoop message_loop_;
+ // Delete all MessageLoopProxy objects before the MessageLoop, to help prevent
+ // leaks caused by tasks posted during shutdown.
+ scoped_refptr<base::MessageLoopProxy> file_thread_proxy_;
+
ScopedTempDir temp_dir_;
FilePath root_path_;
scoped_ptr<net::URLRequest> request_;
scoped_ptr<TestDelegate> delegate_;
scoped_refptr<TestSpecialStoragePolicy> special_storage_policy_;
scoped_refptr<FileSystemContext> file_system_context_;
- scoped_refptr<base::MessageLoopProxy> file_thread_proxy_;
-
- MessageLoop message_loop_;
base::ScopedCallbackFactory<FileSystemDirURLRequestJobTest> callback_factory_;
static net::URLRequestJob* job_;
diff --git a/webkit/fileapi/file_system_url_request_job_unittest.cc b/webkit/fileapi/file_system_url_request_job_unittest.cc
index 5fdb7f4..750f1ed 100644
--- a/webkit/fileapi/file_system_url_request_job_unittest.cc
+++ b/webkit/fileapi/file_system_url_request_job_unittest.cc
@@ -109,13 +109,6 @@ class FileSystemURLRequestJobTest : public testing::Test {
}
virtual void TearDown() {
- // NOTE: order matters, request must die before delegate
- request_.reset(NULL);
- delegate_.reset(NULL);
-
- // This shouldn't be necessary, but it shuts HeapChecker up.
- file_system_context_ = NULL;
-
net::URLRequest::RegisterProtocolFactory("filesystem", NULL);
}
@@ -215,15 +208,19 @@ class FileSystemURLRequestJobTest : public testing::Test {
return temp;
}
+ // Put the message loop at the top, so that it's the last thing deleted.
+ MessageLoop message_loop_;
+
ScopedTempDir temp_dir_;
FilePath origin_root_path_;
- scoped_ptr<net::URLRequest> request_;
- scoped_ptr<TestDelegate> delegate_;
scoped_refptr<TestSpecialStoragePolicy> special_storage_policy_;
scoped_refptr<FileSystemContext> file_system_context_;
- MessageLoop message_loop_;
base::ScopedCallbackFactory<FileSystemURLRequestJobTest> callback_factory_;
+ // NOTE: order matters, request must die before delegate
+ scoped_ptr<TestDelegate> delegate_;
+ scoped_ptr<net::URLRequest> request_;
+
static net::URLRequestJob* job_;
};