| OLD | NEW |
| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 if (!host->GetRenderFrameIDsForInstance(instance, | 94 if (!host->GetRenderFrameIDsForInstance(instance, |
| 95 &render_process_id_, | 95 &render_process_id_, |
| 96 &unused)) { | 96 &unused)) { |
| 97 render_process_id_ = -1; | 97 render_process_id_ = -1; |
| 98 } | 98 } |
| 99 file_message_loop_ = BrowserThread::GetMessageLoopProxyForThread( | 99 file_message_loop_ = BrowserThread::GetMessageLoopProxyForThread( |
| 100 BrowserThread::FILE); | 100 BrowserThread::FILE); |
| 101 } | 101 } |
| 102 | 102 |
| 103 PepperFileIOHost::~PepperFileIOHost() { | 103 PepperFileIOHost::~PepperFileIOHost() { |
| 104 // FileIOResource will normally send a close message, but the plugin may have | |
| 105 // crashed. | |
| 106 OnHostMsgClose(NULL, max_written_offset_); | |
| 107 } | 104 } |
| 108 | 105 |
| 109 int32_t PepperFileIOHost::OnResourceMessageReceived( | 106 int32_t PepperFileIOHost::OnResourceMessageReceived( |
| 110 const IPC::Message& msg, | 107 const IPC::Message& msg, |
| 111 ppapi::host::HostMessageContext* context) { | 108 ppapi::host::HostMessageContext* context) { |
| 112 IPC_BEGIN_MESSAGE_MAP(PepperFileIOHost, msg) | 109 IPC_BEGIN_MESSAGE_MAP(PepperFileIOHost, msg) |
| 113 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Open, | 110 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Open, |
| 114 OnHostMsgOpen) | 111 OnHostMsgOpen) |
| 115 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Touch, | 112 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_FileIO_Touch, |
| 116 OnHostMsgTouch) | 113 OnHostMsgTouch) |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 464 |
| 468 ppapi::proxy::SerializedHandle file_handle; | 465 ppapi::proxy::SerializedHandle file_handle; |
| 469 // A non-zero resource id signals NaClIPCAdapter to create a NaClQuotaDesc. | 466 // A non-zero resource id signals NaClIPCAdapter to create a NaClQuotaDesc. |
| 470 PP_Resource quota_file_io = check_quota_ ? pp_resource() : 0; | 467 PP_Resource quota_file_io = check_quota_ ? pp_resource() : 0; |
| 471 file_handle.set_file_handle(transit_file, open_flags, quota_file_io); | 468 file_handle.set_file_handle(transit_file, open_flags, quota_file_io); |
| 472 reply_context->params.AppendHandle(file_handle); | 469 reply_context->params.AppendHandle(file_handle); |
| 473 return true; | 470 return true; |
| 474 } | 471 } |
| 475 | 472 |
| 476 } // namespace content | 473 } // namespace content |
| OLD | NEW |