Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / renderer / pepper / ppb_broker_impl.cc
index f68d257..33181a2 100644 (file)
@@ -6,7 +6,6 @@
 
 #include "base/logging.h"
 #include "content/common/view_messages.h"
-#include "content/renderer/pepper/common.h"
 #include "content/renderer/pepper/host_globals.h"
 #include "content/renderer/pepper/pepper_broker.h"
 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
@@ -31,9 +30,9 @@ PPB_Broker_Impl::PPB_Broker_Impl(PP_Instance instance)
     : Resource(ppapi::OBJECT_IS_IMPL, instance),
       broker_(NULL),
       connect_callback_(),
-      pipe_handle_(PlatformFileToInt(base::kInvalidPlatformFileValue)),
+      pipe_handle_(PlatformFileToInt(base::SyncSocket::kInvalidHandle)),
       routing_id_(RenderThreadImpl::current()->GenerateRoutingID()) {
-  ChildThread::current()->AddRoute(routing_id_, this);
+  ChildThread::current()->GetRouter()->AddRoute(routing_id_, this);
 }
 
 PPB_Broker_Impl::~PPB_Broker_Impl() {
@@ -43,13 +42,11 @@ PPB_Broker_Impl::~PPB_Broker_Impl() {
   }
 
   // The plugin owns the handle.
-  pipe_handle_ = PlatformFileToInt(base::kInvalidPlatformFileValue);
-  ChildThread::current()->RemoveRoute(routing_id_);
+  pipe_handle_ = PlatformFileToInt(base::SyncSocket::kInvalidHandle);
+  ChildThread::current()->GetRouter()->RemoveRoute(routing_id_);
 }
 
-PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() {
-  return this;
-}
+PPB_Broker_API* PPB_Broker_Impl::AsPPB_Broker_API() { return this; }
 
 int32_t PPB_Broker_Impl::Connect(
     scoped_refptr<TrackedCallback> connect_callback) {
@@ -78,13 +75,13 @@ int32_t PPB_Broker_Impl::Connect(
     broker_ = new PepperBroker(module);
 
     // Have the browser start the broker process for us.
-    RenderThreadImpl::current()->Send(new ViewHostMsg_OpenChannelToPpapiBroker(
-        routing_id_, broker_path));
+    RenderThreadImpl::current()->Send(
+        new ViewHostMsg_OpenChannelToPpapiBroker(routing_id_, broker_path));
   }
 
   RenderThreadImpl::current()->Send(
       new ViewHostMsg_RequestPpapiBrokerPermission(
-          plugin_instance->render_view()->GetRoutingID(),
+          plugin_instance->render_frame()->render_view()->GetRoutingID(),
           routing_id_,
           GetDocumentUrl(),
           broker_path));
@@ -97,7 +94,7 @@ int32_t PPB_Broker_Impl::Connect(
 }
 
 int32_t PPB_Broker_Impl::GetHandle(int32_t* handle) {
-  if (pipe_handle_ == PlatformFileToInt(base::kInvalidPlatformFileValue))
+  if (pipe_handle_ == PlatformFileToInt(base::SyncSocket::kInvalidHandle))
     return PP_ERROR_FAILED;  // Handle not set yet.
   *handle = pipe_handle_;
   return PP_OK;
@@ -111,10 +108,9 @@ GURL PPB_Broker_Impl::GetDocumentUrl() {
 
 // Transfers ownership of the handle to the plugin.
 void PPB_Broker_Impl::BrokerConnected(int32_t handle, int32_t result) {
-  DCHECK(pipe_handle_ ==
-         PlatformFileToInt(base::kInvalidPlatformFileValue));
+  DCHECK(pipe_handle_ == PlatformFileToInt(base::SyncSocket::kInvalidHandle));
   DCHECK(result == PP_OK ||
-         handle == PlatformFileToInt(base::kInvalidPlatformFileValue));
+         handle == PlatformFileToInt(base::SyncSocket::kInvalidHandle));
 
   pipe_handle_ = handle;