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_broker_proxy.h" | 5 #include "ppapi/proxy/ppb_broker_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/trusted/ppb_broker_trusted.h" | 9 #include "ppapi/c/trusted/ppb_broker_trusted.h" |
10 #include "ppapi/proxy/enter_proxy.h" | 10 #include "ppapi/proxy/enter_proxy.h" |
11 #include "ppapi/proxy/plugin_dispatcher.h" | 11 #include "ppapi/proxy/plugin_dispatcher.h" |
12 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
13 #include "ppapi/shared_impl/platform_file.h" | 13 #include "ppapi/shared_impl/platform_file.h" |
14 #include "ppapi/shared_impl/tracked_callback.h" | 14 #include "ppapi/shared_impl/tracked_callback.h" |
15 #include "ppapi/thunk/ppb_broker_api.h" | 15 #include "ppapi/thunk/ppb_broker_api.h" |
16 #include "ppapi/thunk/enter.h" | 16 #include "ppapi/thunk/enter.h" |
17 #include "ppapi/thunk/resource_creation_api.h" | 17 #include "ppapi/thunk/resource_creation_api.h" |
18 #include "ppapi/thunk/thunk.h" | 18 #include "ppapi/thunk/thunk.h" |
19 | 19 |
20 using ppapi::IntToPlatformFile; | 20 using ppapi::IntToPlatformFile; |
21 using ppapi::PlatformFileToInt; | 21 using ppapi::PlatformFileToInt; |
22 using ppapi::thunk::PPB_Broker_API; | 22 using ppapi::thunk::PPB_Broker_API; |
23 | 23 |
24 namespace ppapi { | 24 namespace ppapi { |
25 namespace proxy { | 25 namespace proxy { |
26 | 26 |
27 class Broker : public PPB_Broker_API, public Resource { | 27 class Broker : public PPB_Broker_API, public Resource { |
28 public: | 28 public: |
29 explicit Broker(const HostResource& resource); | 29 explicit Broker(const HostResource& resource); |
30 virtual ~Broker(); | 30 ~Broker() override; |
31 | 31 |
32 // Resource overrides. | 32 // Resource overrides. |
33 virtual PPB_Broker_API* AsPPB_Broker_API() override; | 33 PPB_Broker_API* AsPPB_Broker_API() override; |
34 | 34 |
35 // PPB_Broker_API implementation. | 35 // PPB_Broker_API implementation. |
36 virtual int32_t Connect( | 36 int32_t Connect(scoped_refptr<TrackedCallback> connect_callback) override; |
37 scoped_refptr<TrackedCallback> connect_callback) override; | 37 int32_t GetHandle(int32_t* handle) override; |
38 virtual int32_t GetHandle(int32_t* handle) override; | |
39 | 38 |
40 // Called by the proxy when the host side has completed the request. | 39 // Called by the proxy when the host side has completed the request. |
41 void ConnectComplete(IPC::PlatformFileForTransit socket_handle, | 40 void ConnectComplete(IPC::PlatformFileForTransit socket_handle, |
42 int32_t result); | 41 int32_t result); |
43 | 42 |
44 private: | 43 private: |
45 bool called_connect_; | 44 bool called_connect_; |
46 scoped_refptr<TrackedCallback> current_connect_callback_; | 45 scoped_refptr<TrackedCallback> current_connect_callback_; |
47 | 46 |
48 // The plugin module owns the handle. | 47 // The plugin module owns the handle. |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // The easiest way to clean it up is to just put it in an object | 226 // The easiest way to clean it up is to just put it in an object |
228 // and then close it. This failure case is not performance critical. | 227 // and then close it. This failure case is not performance critical. |
229 // The handle could still leak if Send succeeded but the IPC later failed. | 228 // The handle could still leak if Send succeeded but the IPC later failed. |
230 base::SyncSocket temp_socket( | 229 base::SyncSocket temp_socket( |
231 IPC::PlatformFileForTransitToPlatformFile(foreign_socket_handle)); | 230 IPC::PlatformFileForTransitToPlatformFile(foreign_socket_handle)); |
232 } | 231 } |
233 } | 232 } |
234 | 233 |
235 } // namespace proxy | 234 } // namespace proxy |
236 } // namespace ppapi | 235 } // namespace ppapi |
OLD | NEW |