OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_broker_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/shared_impl/platform_file.h" |
8 #include "webkit/plugins/ppapi/common.h" | 9 #include "webkit/plugins/ppapi/common.h" |
9 #include "webkit/plugins/ppapi/plugin_module.h" | 10 #include "webkit/plugins/ppapi/plugin_module.h" |
10 #include "webkit/plugins/ppapi/resource_helper.h" | 11 #include "webkit/plugins/ppapi/resource_helper.h" |
11 | 12 |
| 13 using ::ppapi::PlatformFileToInt; |
12 using ::ppapi::thunk::PPB_Broker_API; | 14 using ::ppapi::thunk::PPB_Broker_API; |
13 | 15 |
14 namespace webkit { | 16 namespace webkit { |
15 namespace ppapi { | 17 namespace ppapi { |
16 | 18 |
17 namespace { | |
18 | |
19 // TODO(ddorwin): Put conversion functions in a common place and/or add an | |
20 // invalid value to sync_socket.h. | |
21 int32_t PlatformFileToInt(base::PlatformFile handle) { | |
22 #if defined(OS_WIN) | |
23 return static_cast<int32_t>(reinterpret_cast<intptr_t>(handle)); | |
24 #elif defined(OS_POSIX) | |
25 return handle; | |
26 #else | |
27 #error Not implemented. | |
28 #endif | |
29 } | |
30 | |
31 } // namespace | |
32 | |
33 // PPB_Broker_Impl ------------------------------------------------------ | 19 // PPB_Broker_Impl ------------------------------------------------------ |
34 | 20 |
35 PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance) | 21 PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance) |
36 : Resource(instance), | 22 : Resource(instance), |
37 broker_(NULL), | 23 broker_(NULL), |
38 connect_callback_(), | 24 connect_callback_(), |
39 pipe_handle_(PlatformFileToInt(base::kInvalidPlatformFileValue)) { | 25 pipe_handle_(PlatformFileToInt(base::kInvalidPlatformFileValue)) { |
40 } | 26 } |
41 | 27 |
42 PPB_Broker_Impl::~PPB_Broker_Impl() { | 28 PPB_Broker_Impl::~PPB_Broker_Impl() { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // Synchronous calls are not supported. | 94 // Synchronous calls are not supported. |
109 DCHECK(connect_callback_.get() && !connect_callback_->completed()); | 95 DCHECK(connect_callback_.get() && !connect_callback_->completed()); |
110 | 96 |
111 scoped_refptr<TrackedCompletionCallback> callback; | 97 scoped_refptr<TrackedCompletionCallback> callback; |
112 callback.swap(connect_callback_); | 98 callback.swap(connect_callback_); |
113 callback->Run(result); // Will complete abortively if necessary. | 99 callback->Run(result); // Will complete abortively if necessary. |
114 } | 100 } |
115 | 101 |
116 } // namespace ppapi | 102 } // namespace ppapi |
117 } // namespace webkit | 103 } // namespace webkit |
OLD | NEW |