Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: content/browser/renderer_host/gpu_message_filter.cc

Issue 9194005: gpu: reference target surfaces through a globally unique surface id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix more tests Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/browser/renderer_host/gpu_message_filter.h" 9 #include "content/browser/renderer_host/gpu_message_filter.h"
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "content/browser/gpu/gpu_process_host.h" 12 #include "content/browser/gpu/gpu_process_host.h"
13 #include "content/browser/gpu/gpu_surface_tracker.h"
13 #include "content/browser/renderer_host/render_widget_helper.h" 14 #include "content/browser/renderer_host/render_widget_helper.h"
14 #include "content/common/gpu/gpu_messages.h" 15 #include "content/common/gpu/gpu_messages.h"
15 16
16 using content::BrowserThread; 17 using content::BrowserThread;
17 18
18 GpuMessageFilter::GpuMessageFilter(int render_process_id, 19 GpuMessageFilter::GpuMessageFilter(int render_process_id,
19 RenderWidgetHelper* render_widget_helper) 20 RenderWidgetHelper* render_widget_helper)
20 : gpu_host_id_(0), 21 : gpu_host_id_(0),
21 render_process_id_(render_process_id), 22 render_process_id_(render_process_id),
22 render_widget_helper_(render_widget_helper) { 23 render_widget_helper_(render_widget_helper) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 68 }
68 69
69 host->EstablishGpuChannel( 70 host->EstablishGpuChannel(
70 render_process_id_, 71 render_process_id_,
71 base::Bind(&GpuMessageFilter::EstablishChannelCallback, 72 base::Bind(&GpuMessageFilter::EstablishChannelCallback,
72 AsWeakPtr(), 73 AsWeakPtr(),
73 reply)); 74 reply));
74 } 75 }
75 76
76 void GpuMessageFilter::OnCreateViewCommandBuffer( 77 void GpuMessageFilter::OnCreateViewCommandBuffer(
77 int32 render_view_id, 78 int32 surface_id,
78 const GPUCreateCommandBufferConfig& init_params, 79 const GPUCreateCommandBufferConfig& init_params,
79 IPC::Message* reply) { 80 IPC::Message* reply) {
80 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
81 82
83 GpuSurfaceTracker* surface_tracker = GpuSurfaceTracker::Get();
84 gfx::PluginWindowHandle compositing_surface = gfx::kNullPluginWindow;
85
86 int renderer_id = 0;
87 int render_widget_id = 0;
88 bool result = surface_tracker->GetRenderWidgetIDForSurface(
89 surface_id, &renderer_id, &render_widget_id);
90 if (result && renderer_id == render_process_id_) {
91 compositing_surface = surface_tracker->GetSurfaceHandle(surface_id);
92 } else {
93 DLOG(ERROR) << "Renderer " << render_process_id_
94 << " tried to access a surface for renderer " << renderer_id;
95 }
96
82 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_); 97 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
83
84 gfx::PluginWindowHandle compositing_surface =
85 render_widget_helper_->LookupCompositingSurface(render_view_id);
86
87 if (!host || compositing_surface == gfx::kNullPluginWindow) { 98 if (!host || compositing_surface == gfx::kNullPluginWindow) {
88 // TODO(apatrick): Eventually, this IPC message will be routed to a 99 // TODO(apatrick): Eventually, this IPC message will be routed to a
89 // GpuProcessStub with a particular routing ID. The error will be set if 100 // GpuProcessStub with a particular routing ID. The error will be set if
90 // the GpuProcessStub with that routing ID is not in the MessageRouter. 101 // the GpuProcessStub with that routing ID is not in the MessageRouter.
91 reply->set_reply_error(); 102 reply->set_reply_error();
92 Send(reply); 103 Send(reply);
93 return; 104 return;
94 } 105 }
95 106
96 host->CreateViewCommandBuffer( 107 host->CreateViewCommandBuffer(
97 compositing_surface, 108 compositing_surface,
98 render_view_id, 109 surface_id,
99 render_process_id_, 110 render_process_id_,
100 init_params, 111 init_params,
101 base::Bind(&GpuMessageFilter::CreateCommandBufferCallback, 112 base::Bind(&GpuMessageFilter::CreateCommandBufferCallback,
102 AsWeakPtr(), 113 AsWeakPtr(),
103 reply)); 114 reply));
104 } 115 }
105 116
106 void GpuMessageFilter::EstablishChannelCallback( 117 void GpuMessageFilter::EstablishChannelCallback(
107 IPC::Message* reply, 118 IPC::Message* reply,
108 const IPC::ChannelHandle& channel, 119 const IPC::ChannelHandle& channel,
(...skipping 25 matching lines...) Expand all
134 Send(reply); 145 Send(reply);
135 } 146 }
136 147
137 void GpuMessageFilter::CreateCommandBufferCallback( 148 void GpuMessageFilter::CreateCommandBufferCallback(
138 IPC::Message* reply, int32 route_id) { 149 IPC::Message* reply, int32 route_id) {
139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
140 GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply, route_id); 151 GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply, route_id);
141 Send(reply); 152 Send(reply);
142 } 153 }
143 154
OLDNEW
« no previous file with comments | « content/browser/renderer_host/gpu_message_filter.h ('k') | content/browser/renderer_host/image_transport_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698