Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / gpu_message_filter.cc
index 8a14cf6..856d14b 100644 (file)
@@ -16,7 +16,7 @@
 #include "content/browser/gpu/gpu_surface_tracker.h"
 #include "content/browser/renderer_host/render_widget_helper.h"
 #include "content/common/gpu/gpu_messages.h"
-#include "content/port/browser/render_widget_host_view_frame_subscriber.h"
+#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
 #include "content/public/common/content_switches.h"
 #include "gpu/command_buffer/service/gpu_switches.h"
 
@@ -57,28 +57,13 @@ GpuMessageFilter::GpuMessageFilter(int render_process_id,
     : BrowserMessageFilter(GpuMsgStart),
       gpu_process_id_(0),
       render_process_id_(render_process_id),
-      share_contexts_(false),
       render_widget_helper_(render_widget_helper),
       weak_ptr_factory_(this) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
-#if defined(USE_AURA) || defined(OS_ANDROID)
-  // We use the GPU process for UI on Aura, and we need to share renderer GL
-  // contexts with the compositor context.
-  share_contexts_ = true;
-#else
-  // Share contexts when compositing webview plugin or using share groups
-  // for asynchronous texture uploads.
-  if (!CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kDisableBrowserPluginCompositing) ||
-      CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kEnableShareGroupAsyncTextureUpload))
-    share_contexts_ = true;
-#endif
+  DCHECK_CURRENTLY_ON(BrowserThread::UI);
 }
 
 GpuMessageFilter::~GpuMessageFilter() {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
   EndAllFrameSubscriptions();
 }
 
@@ -99,14 +84,14 @@ bool GpuMessageFilter::OnMessageReceived(
 void GpuMessageFilter::BeginFrameSubscription(
     int route_id,
     scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
   linked_ptr<FrameSubscription> subscription(
       new FrameSubscription(route_id, subscriber.Pass()));
   BeginFrameSubscriptionInternal(subscription);
 }
 
 void GpuMessageFilter::EndFrameSubscription(int route_id) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
   FrameSubscriptionList frame_subscription_list;
   frame_subscription_list.swap(frame_subscription_list_);
   for (FrameSubscriptionList::iterator it = frame_subscription_list.begin();
@@ -121,7 +106,7 @@ void GpuMessageFilter::EndFrameSubscription(int route_id) {
 void GpuMessageFilter::OnEstablishGpuChannel(
     CauseForGpuLaunch cause_for_gpu_launch,
     IPC::Message* reply_ptr) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
   scoped_ptr<IPC::Message> reply(reply_ptr);
 
   // TODO(apatrick): Eventually, this will return the route ID of a
@@ -147,9 +132,10 @@ void GpuMessageFilter::OnEstablishGpuChannel(
     BeginAllFrameSubscriptions();
   }
 
+  bool share_contexts = true;
   host->EstablishGpuChannel(
       render_process_id_,
-      share_contexts_,
+      share_contexts,
       base::Bind(&GpuMessageFilter::EstablishChannelCallback,
                  weak_ptr_factory_.GetWeakPtr(),
                  base::Passed(&reply)));
@@ -158,8 +144,9 @@ void GpuMessageFilter::OnEstablishGpuChannel(
 void GpuMessageFilter::OnCreateViewCommandBuffer(
     int32 surface_id,
     const GPUCreateCommandBufferConfig& init_params,
+    int32 route_id,
     IPC::Message* reply_ptr) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
   scoped_ptr<IPC::Message> reply(reply_ptr);
 
   GpuSurfaceTracker* surface_tracker = GpuSurfaceTracker::Get();
@@ -197,6 +184,7 @@ void GpuMessageFilter::OnCreateViewCommandBuffer(
       surface_id,
       render_process_id_,
       init_params,
+      route_id,
       base::Bind(&GpuMessageFilter::CreateCommandBufferCallback,
                  weak_ptr_factory_.GetWeakPtr(),
                  base::Passed(&reply)));
@@ -206,7 +194,7 @@ void GpuMessageFilter::EstablishChannelCallback(
     scoped_ptr<IPC::Message> reply,
     const IPC::ChannelHandle& channel,
     const gpu::GPUInfo& gpu_info) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
   GpuHostMsg_EstablishGpuChannel::WriteReplyParams(
       reply.get(), render_process_id_, channel, gpu_info);
@@ -214,9 +202,9 @@ void GpuMessageFilter::EstablishChannelCallback(
 }
 
 void GpuMessageFilter::CreateCommandBufferCallback(
-    scoped_ptr<IPC::Message> reply, int32 route_id) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-  GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply.get(), route_id);
+    scoped_ptr<IPC::Message> reply, bool succeeded) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+  GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply.get(), succeeded);
   Send(reply.release());
 }