| 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/ppb_file_ref_proxy.h" | 5 #include "ppapi/proxy/ppb_file_ref_proxy.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 int FileRef::SendCallback(scoped_refptr<TrackedCallback> callback) { | 159 int FileRef::SendCallback(scoped_refptr<TrackedCallback> callback) { |
| 160 // In extreme cases the IDs may wrap around, so avoid duplicates. | 160 // In extreme cases the IDs may wrap around, so avoid duplicates. |
| 161 while (pending_callbacks_.count(next_callback_id_)) | 161 while (pending_callbacks_.count(next_callback_id_)) |
| 162 ++next_callback_id_; | 162 ++next_callback_id_; |
| 163 | 163 |
| 164 pending_callbacks_[next_callback_id_] = callback; | 164 pending_callbacks_[next_callback_id_] = callback; |
| 165 return next_callback_id_++; | 165 return next_callback_id_++; |
| 166 } | 166 } |
| 167 | 167 |
| 168 namespace { | |
| 169 | |
| 170 InterfaceProxy* CreateFileRefProxy(Dispatcher* dispatcher) { | |
| 171 return new PPB_FileRef_Proxy(dispatcher); | |
| 172 } | |
| 173 | |
| 174 } // namespace | |
| 175 | |
| 176 PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher) | 168 PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher) |
| 177 : InterfaceProxy(dispatcher), | 169 : InterfaceProxy(dispatcher), |
| 178 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 170 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 179 } | 171 } |
| 180 | 172 |
| 181 PPB_FileRef_Proxy::~PPB_FileRef_Proxy() { | 173 PPB_FileRef_Proxy::~PPB_FileRef_Proxy() { |
| 182 } | 174 } |
| 183 | 175 |
| 184 // static | 176 // static |
| 185 PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system, | 177 PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 int32_t result, | 312 int32_t result, |
| 321 const HostResource& host_resource, | 313 const HostResource& host_resource, |
| 322 int callback_id) { | 314 int callback_id) { |
| 323 // Execute OnMsgCallbackComplete in the plugin process. | 315 // Execute OnMsgCallbackComplete in the plugin process. |
| 324 Send(new PpapiMsg_PPBFileRef_CallbackComplete( | 316 Send(new PpapiMsg_PPBFileRef_CallbackComplete( |
| 325 API_ID_PPB_FILE_REF, host_resource, callback_id, result)); | 317 API_ID_PPB_FILE_REF, host_resource, callback_id, result)); |
| 326 } | 318 } |
| 327 | 319 |
| 328 } // namespace proxy | 320 } // namespace proxy |
| 329 } // namespace ppapi | 321 } // namespace ppapi |
| OLD | NEW |