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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 called_close_ = true; | 390 called_close_ = true; |
391 if (check_quota_) { | 391 if (check_quota_) { |
392 check_quota_ = false; | 392 check_quota_ = false; |
393 file_system_resource_->AsPPB_FileSystem_API()->CloseQuotaFile( | 393 file_system_resource_->AsPPB_FileSystem_API()->CloseQuotaFile( |
394 pp_resource()); | 394 pp_resource()); |
395 } | 395 } |
396 | 396 |
397 if (file_handle_) | 397 if (file_handle_) |
398 file_handle_ = NULL; | 398 file_handle_ = NULL; |
399 | 399 |
400 // TODO(tzik): Post |max_written_offset_| and |append_mode_write_amount_| | |
401 // separately by using FileGrowth after the IPC signature changed. | |
402 Post(BROWSER, PpapiHostMsg_FileIO_Close( | 400 Post(BROWSER, PpapiHostMsg_FileIO_Close( |
403 max_written_offset_ + append_mode_write_amount_)); | 401 FileGrowth(max_written_offset_, append_mode_write_amount_))); |
404 } | 402 } |
405 | 403 |
406 int32_t FileIOResource::RequestOSFileHandle( | 404 int32_t FileIOResource::RequestOSFileHandle( |
407 PP_FileHandle* handle, | 405 PP_FileHandle* handle, |
408 scoped_refptr<TrackedCallback> callback) { | 406 scoped_refptr<TrackedCallback> callback) { |
409 int32_t rv = state_manager_.CheckOperationState( | 407 int32_t rv = state_manager_.CheckOperationState( |
410 FileIOStateManager::OPERATION_EXCLUSIVE, true); | 408 FileIOStateManager::OPERATION_EXCLUSIVE, true); |
411 if (rv != PP_OK) | 409 if (rv != PP_OK) |
412 return rv; | 410 return rv; |
413 | 411 |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file); | 694 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file); |
697 | 695 |
698 // End this operation now, so the user's callback can execute another FileIO | 696 // End this operation now, so the user's callback can execute another FileIO |
699 // operation, assuming there are no other pending operations. | 697 // operation, assuming there are no other pending operations. |
700 state_manager_.SetOperationFinished(); | 698 state_manager_.SetOperationFinished(); |
701 callback->Run(result); | 699 callback->Run(result); |
702 } | 700 } |
703 | 701 |
704 } // namespace proxy | 702 } // namespace proxy |
705 } // namespace ppapi | 703 } // namespace ppapi |
OLD | NEW |