OLD | NEW |
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 "ppapi/proxy/file_io_resource.h" | 5 #include "ppapi/proxy/file_io_resource.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/task_runner_util.h" | 8 #include "base/task_runner_util.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 called_close_ = true; | 397 called_close_ = true; |
398 if (check_quota_) { | 398 if (check_quota_) { |
399 check_quota_ = false; | 399 check_quota_ = false; |
400 file_system_resource_->AsPPB_FileSystem_API()->CloseQuotaFile( | 400 file_system_resource_->AsPPB_FileSystem_API()->CloseQuotaFile( |
401 pp_resource()); | 401 pp_resource()); |
402 } | 402 } |
403 | 403 |
404 if (file_handle_) | 404 if (file_handle_) |
405 file_handle_ = NULL; | 405 file_handle_ = NULL; |
406 | 406 |
407 // TODO(tzik): Post |max_written_offset_| and |append_mode_write_amount_| | |
408 // separately by using FileGrowth after the IPC signature changed. | |
409 Post(BROWSER, PpapiHostMsg_FileIO_Close( | 407 Post(BROWSER, PpapiHostMsg_FileIO_Close( |
410 max_written_offset_ + append_mode_write_amount_)); | 408 FileGrowth(max_written_offset_, append_mode_write_amount_))); |
411 } | 409 } |
412 | 410 |
413 int32_t FileIOResource::RequestOSFileHandle( | 411 int32_t FileIOResource::RequestOSFileHandle( |
414 PP_FileHandle* handle, | 412 PP_FileHandle* handle, |
415 scoped_refptr<TrackedCallback> callback) { | 413 scoped_refptr<TrackedCallback> callback) { |
416 int32_t rv = state_manager_.CheckOperationState( | 414 int32_t rv = state_manager_.CheckOperationState( |
417 FileIOStateManager::OPERATION_EXCLUSIVE, true); | 415 FileIOStateManager::OPERATION_EXCLUSIVE, true); |
418 if (rv != PP_OK) | 416 if (rv != PP_OK) |
419 return rv; | 417 return rv; |
420 | 418 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file); | 701 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file); |
704 | 702 |
705 // End this operation now, so the user's callback can execute another FileIO | 703 // End this operation now, so the user's callback can execute another FileIO |
706 // operation, assuming there are no other pending operations. | 704 // operation, assuming there are no other pending operations. |
707 state_manager_.SetOperationFinished(); | 705 state_manager_.SetOperationFinished(); |
708 callback->Run(result); | 706 callback->Run(result); |
709 } | 707 } |
710 | 708 |
711 } // namespace proxy | 709 } // namespace proxy |
712 } // namespace ppapi | 710 } // namespace ppapi |
OLD | NEW |