| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // static | 51 // static |
| 52 PP_Resource PPB_Broker_Impl::Create(PP_Instance instance_id) { | 52 PP_Resource PPB_Broker_Impl::Create(PP_Instance instance_id) { |
| 53 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 53 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
| 54 if (!instance) | 54 if (!instance) |
| 55 return 0; | 55 return 0; |
| 56 scoped_refptr<PPB_Broker_Impl> broker(new PPB_Broker_Impl(instance)); | 56 scoped_refptr<PPB_Broker_Impl> broker(new PPB_Broker_Impl(instance)); |
| 57 return broker->GetReference(); | 57 return broker->GetReference(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 PPB_Broker_Impl* PPB_Broker_Impl::AsPPB_Broker_Impl() { | |
| 61 return this; | |
| 62 } | |
| 63 | |
| 64 PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() { | 60 PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() { |
| 65 return this; | 61 return this; |
| 66 } | 62 } |
| 67 | 63 |
| 68 int32_t PPB_Broker_Impl::Connect(PP_CompletionCallback connect_callback) { | 64 int32_t PPB_Broker_Impl::Connect(PP_CompletionCallback connect_callback) { |
| 69 if (!connect_callback.func) { | 65 if (!connect_callback.func) { |
| 70 // Synchronous calls are not supported. | 66 // Synchronous calls are not supported. |
| 71 return PP_ERROR_BADARGUMENT; | 67 return PP_ERROR_BADARGUMENT; |
| 72 } | 68 } |
| 73 | 69 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // Synchronous calls are not supported. | 114 // Synchronous calls are not supported. |
| 119 DCHECK(connect_callback_.get() && !connect_callback_->completed()); | 115 DCHECK(connect_callback_.get() && !connect_callback_->completed()); |
| 120 | 116 |
| 121 scoped_refptr<TrackedCompletionCallback> callback; | 117 scoped_refptr<TrackedCompletionCallback> callback; |
| 122 callback.swap(connect_callback_); | 118 callback.swap(connect_callback_); |
| 123 callback->Run(result); // Will complete abortively if necessary. | 119 callback->Run(result); // Will complete abortively if necessary. |
| 124 } | 120 } |
| 125 | 121 |
| 126 } // namespace ppapi | 122 } // namespace ppapi |
| 127 } // namespace webkit | 123 } // namespace webkit |
| OLD | NEW |