diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 19:18:51 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 19:18:51 +0000 |
commit | ee405c220b9c2551c6138c79375bf0f553cdb8c4 (patch) | |
tree | 73111b1d92e9113725b5e020d79bbe32519ad840 /ppapi/tests | |
parent | 8fd7b2d6cd00d43f63ccee9bd3372e79814b137b (diff) | |
download | chromium_src-ee405c220b9c2551c6138c79375bf0f553cdb8c4.zip chromium_src-ee405c220b9c2551c6138c79375bf0f553cdb8c4.tar.gz chromium_src-ee405c220b9c2551c6138c79375bf0f553cdb8c4.tar.bz2 |
Avoid leaking file handles.
AsyncOpenFileCallback: fix the issue that file handle is leaked if the file handle arrives after the requester has died.
This change also fixes test_file_system.
BUG=79820
TEST=FileIO/FileRef/FileSystem tests in ppapi_tests: Reload the test page, the test still passes. The output files can be deleted when any of these tests finishes running, no matter the test page is still open or not.
Review URL: http://codereview.chromium.org/7327025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92727 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r-- | ppapi/tests/test_file_system.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ppapi/tests/test_file_system.cc b/ppapi/tests/test_file_system.cc index 9232385..cb37284 100644 --- a/ppapi/tests/test_file_system.cc +++ b/ppapi/tests/test_file_system.cc @@ -67,7 +67,9 @@ std::string TestFileSystem::TestMultipleOpens() { int32_t rv_2 = file_system.Open(1024, callback_2); if (force_async_ && rv_2 != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open2 force_async", rv_2); - if (rv_2 == PP_OK_COMPLETIONPENDING || rv_2 == PP_OK) + if (rv_2 == PP_OK_COMPLETIONPENDING) + rv_2 = callback_2.WaitForResult(); + if (rv_2 == PP_OK) return "FileSystem::Open2 should not allow multiple opens."; if (rv_1 == PP_OK_COMPLETIONPENDING) @@ -79,7 +81,9 @@ std::string TestFileSystem::TestMultipleOpens() { int32_t rv_3 = file_system.Open(1024, callback_3); if (force_async_ && rv_3 != PP_OK_COMPLETIONPENDING) return ReportError("FileSystem::Open3 force_async", rv_3); - if (rv_3 == PP_OK_COMPLETIONPENDING || rv_3 == PP_OK) + if (rv_3 == PP_OK_COMPLETIONPENDING) + rv_3 = callback_3.WaitForResult(); + if (rv_3 == PP_OK) return "FileSystem::Open3 should not allow multiple opens."; PASS(); |