| 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 "webkit/plugins/ppapi/common.h" | 8 #include "webkit/plugins/ppapi/common.h" |
| 9 #include "webkit/plugins/ppapi/plugin_module.h" | 9 #include "webkit/plugins/ppapi/plugin_module.h" |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 PP_Resource resource_id = GetReferenceNoAddRef(); | 101 PP_Resource resource_id = GetReferenceNoAddRef(); |
| 102 CHECK(resource_id); | 102 CHECK(resource_id); |
| 103 connect_callback_ = new TrackedCompletionCallback( | 103 connect_callback_ = new TrackedCompletionCallback( |
| 104 instance()->module()->GetCallbackTracker(), resource_id, | 104 instance()->module()->GetCallbackTracker(), resource_id, |
| 105 connect_callback); | 105 connect_callback); |
| 106 return PP_ERROR_WOULDBLOCK; | 106 return PP_ERROR_WOULDBLOCK; |
| 107 } | 107 } |
| 108 | 108 |
| 109 int32_t PPB_Broker_Impl::GetHandle(int32_t* handle) { | 109 int32_t PPB_Broker_Impl::GetHandle(int32_t* handle) { |
| 110 *handle = pipe_handle_; | 110 if (!pipe_handle_) |
| 111 | |
| 112 if (!*handle) | |
| 113 return PP_ERROR_FAILED; | 111 return PP_ERROR_FAILED; |
| 114 | 112 |
| 113 *handle = pipe_handle_; |
| 115 return PP_OK; | 114 return PP_OK; |
| 116 } | 115 } |
| 117 | 116 |
| 118 PPB_Broker_Impl* PPB_Broker_Impl::AsPPB_Broker_Impl() { | 117 PPB_Broker_Impl* PPB_Broker_Impl::AsPPB_Broker_Impl() { |
| 119 return this; | 118 return this; |
| 120 } | 119 } |
| 121 | 120 |
| 122 void PPB_Broker_Impl::BrokerConnected(int32_t handle) { | 121 void PPB_Broker_Impl::BrokerConnected(int32_t handle) { |
| 123 DCHECK(handle); | 122 DCHECK(handle); |
| 124 pipe_handle_ = handle; | 123 pipe_handle_ = handle; |
| 125 | 124 |
| 126 // Synchronous calls are not supported. | 125 // Synchronous calls are not supported. |
| 127 DCHECK(connect_callback_.get() && !connect_callback_->completed()); | 126 DCHECK(connect_callback_.get() && !connect_callback_->completed()); |
| 128 | 127 |
| 129 scoped_refptr<TrackedCompletionCallback> callback; | 128 scoped_refptr<TrackedCompletionCallback> callback; |
| 130 callback.swap(connect_callback_); | 129 callback.swap(connect_callback_); |
| 131 callback->Run(0); // Will complete abortively if necessary. | 130 callback->Run(0); // Will complete abortively if necessary. |
| 132 } | 131 } |
| 133 | 132 |
| 134 } // namespace ppapi | 133 } // namespace ppapi |
| 135 } // namespace webkit | 134 } // namespace webkit |
| OLD | NEW |