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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_file_io_host.cc

Issue 121813002: Pepper: Ensure FileIO host cleans up before FileSystem host destructs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Close message to ensure work is done before FileSystemHost dtor. Created 6 years, 11 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 | « no previous file | ppapi/proxy/file_io_resource.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/renderer_host/pepper/pepper_file_io_host.h" 5 #include "content/browser/renderer_host/pepper/pepper_file_io_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/files/file_util_proxy.h" 10 #include "base/files/file_util_proxy.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 weak_factory_.GetWeakPtr(), 398 weak_factory_.GetWeakPtr(),
399 context->MakeReplyMessageContext()))) 399 context->MakeReplyMessageContext())))
400 return PP_ERROR_FAILED; 400 return PP_ERROR_FAILED;
401 401
402 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); 402 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE);
403 return PP_OK_COMPLETIONPENDING; 403 return PP_OK_COMPLETIONPENDING;
404 } 404 }
405 405
406 int32_t PepperFileIOHost::OnHostMsgClose( 406 int32_t PepperFileIOHost::OnHostMsgClose(
407 ppapi::host::HostMessageContext* context) { 407 ppapi::host::HostMessageContext* context) {
408 if (check_quota_) 408 if (check_quota_) {
409 file_system_host_->CloseQuotaFile(this); 409 file_system_host_->CloseQuotaFile(this);
410 check_quota_ = false;
bbudge 2013/12/27 20:04:28 This ensures we don't do this twice.
411 }
410 412
411 if (file_ != base::kInvalidPlatformFileValue) { 413 if (file_ != base::kInvalidPlatformFileValue) {
412 base::FileUtilProxy::Close( 414 base::FileUtilProxy::Close(
413 file_message_loop_, 415 file_message_loop_,
414 file_, 416 file_,
415 base::Bind(&PepperFileIOHost::DidCloseFile, 417 base::Bind(&PepperFileIOHost::DidCloseFile,
416 weak_factory_.GetWeakPtr())); 418 weak_factory_.GetWeakPtr()));
417 file_ = base::kInvalidPlatformFileValue; 419 file_ = base::kInvalidPlatformFileValue;
418 } 420 }
419 return PP_OK; 421 return PP_OK;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 file_, plugin_process_id, false); 602 file_, plugin_process_id, false);
601 if (transit_file == IPC::InvalidPlatformFileForTransit()) 603 if (transit_file == IPC::InvalidPlatformFileForTransit())
602 return false; 604 return false;
603 ppapi::proxy::SerializedHandle file_handle; 605 ppapi::proxy::SerializedHandle file_handle;
604 file_handle.set_file_handle(transit_file, open_flags, 0 /* file_io */); 606 file_handle.set_file_handle(transit_file, open_flags, 0 /* file_io */);
605 reply_context->params.AppendHandle(file_handle); 607 reply_context->params.AppendHandle(file_handle);
606 return true; 608 return true;
607 } 609 }
608 610
609 } // namespace content 611 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/file_io_resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698