| 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 "content/renderer/pepper/ppb_broker_impl.h" | 5 #include "content/renderer/pepper/ppb_broker_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
| 9 #include "content/renderer/pepper/host_globals.h" | 9 #include "content/renderer/pepper/host_globals.h" |
| 10 #include "content/renderer/pepper/pepper_broker.h" | 10 #include "content/renderer/pepper/pepper_broker.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 // PPB_Broker_Impl ------------------------------------------------------ | 27 // PPB_Broker_Impl ------------------------------------------------------ |
| 28 | 28 |
| 29 PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance) | 29 PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance) |
| 30 : Resource(ppapi::OBJECT_IS_IMPL, instance), | 30 : Resource(ppapi::OBJECT_IS_IMPL, instance), |
| 31 broker_(NULL), | 31 broker_(NULL), |
| 32 connect_callback_(), | 32 connect_callback_(), |
| 33 pipe_handle_(PlatformFileToInt(base::SyncSocket::kInvalidHandle)), | 33 pipe_handle_(PlatformFileToInt(base::SyncSocket::kInvalidHandle)), |
| 34 routing_id_(RenderThreadImpl::current()->GenerateRoutingID()) { | 34 routing_id_(RenderThreadImpl::current()->GenerateRoutingID()) { |
| 35 ChildThread::current()->GetRouter()->AddRoute(routing_id_, this); | 35 ChildThreadImpl::current()->GetRouter()->AddRoute(routing_id_, this); |
| 36 } | 36 } |
| 37 | 37 |
| 38 PPB_Broker_Impl::~PPB_Broker_Impl() { | 38 PPB_Broker_Impl::~PPB_Broker_Impl() { |
| 39 if (broker_) { | 39 if (broker_) { |
| 40 broker_->Disconnect(this); | 40 broker_->Disconnect(this); |
| 41 broker_ = NULL; | 41 broker_ = NULL; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // The plugin owns the handle. | 44 // The plugin owns the handle. |
| 45 pipe_handle_ = PlatformFileToInt(base::SyncSocket::kInvalidHandle); | 45 pipe_handle_ = PlatformFileToInt(base::SyncSocket::kInvalidHandle); |
| 46 ChildThread::current()->GetRouter()->RemoveRoute(routing_id_); | 46 ChildThreadImpl::current()->GetRouter()->RemoveRoute(routing_id_); |
| 47 } | 47 } |
| 48 | 48 |
| 49 PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() { return this; } | 49 PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() { return this; } |
| 50 | 50 |
| 51 int32_t PPB_Broker_Impl::Connect( | 51 int32_t PPB_Broker_Impl::Connect( |
| 52 scoped_refptr<TrackedCallback> connect_callback) { | 52 scoped_refptr<TrackedCallback> connect_callback) { |
| 53 // TODO(ddorwin): Return PP_ERROR_FAILED if plugin is in-process. | 53 // TODO(ddorwin): Return PP_ERROR_FAILED if plugin is in-process. |
| 54 | 54 |
| 55 if (broker_) { | 55 if (broker_) { |
| 56 // May only be called once. | 56 // May only be called once. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 base::ProcessId broker_pid, | 136 base::ProcessId broker_pid, |
| 137 const IPC::ChannelHandle& handle) { | 137 const IPC::ChannelHandle& handle) { |
| 138 broker_->OnBrokerChannelConnected(broker_pid, handle); | 138 broker_->OnBrokerChannelConnected(broker_pid, handle); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void PPB_Broker_Impl::OnPpapiBrokerPermissionResult(bool result) { | 141 void PPB_Broker_Impl::OnPpapiBrokerPermissionResult(bool result) { |
| 142 broker_->OnBrokerPermissionResult(this, result); | 142 broker_->OnBrokerPermissionResult(this, result); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace content | 145 } // namespace content |
| OLD | NEW |