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

Side by Side Diff: chrome/browser/gpu_process_host_ui_shim.cc

Issue 6880218: Removed "compositor" child window that was created by the GPU process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 // TODO(jam): move this file to src/content once we have an interface that the 1 // TODO(jam): move this file to src/content once we have an interface that the
2 // embedder provides. We can then use it to get the resource and resize the 2 // embedder provides. We can then use it to get the resource and resize the
3 // window. 3 // window.
4 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 4 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style license that can be 5 // Use of this source code is governed by a BSD-style license that can be
6 // found in the LICENSE file. 6 // found in the LICENSE file.
7 7
8 #include "chrome/browser/gpu_process_host_ui_shim.h" 8 #include "chrome/browser/gpu_process_host_ui_shim.h"
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 } 221 }
222 222
223 bool GpuProcessHostUIShim::OnControlMessageReceived( 223 bool GpuProcessHostUIShim::OnControlMessageReceived(
224 const IPC::Message& message) { 224 const IPC::Message& message) {
225 DCHECK(CalledOnValidThread()); 225 DCHECK(CalledOnValidThread());
226 226
227 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message) 227 IPC_BEGIN_MESSAGE_MAP(GpuProcessHostUIShim, message)
228 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage, 228 IPC_MESSAGE_HANDLER(GpuHostMsg_OnLogMessage,
229 OnLogMessage) 229 OnLogMessage)
230 #if defined(OS_LINUX) && !defined(TOUCH_UI) 230 #if defined(OS_LINUX) && !defined(TOUCH_UI) || defined(OS_WIN)
231 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_ResizeXID, OnResizeXID) 231 IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
232 #elif defined(OS_MACOSX) 232 #elif defined(OS_MACOSX)
233 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface, 233 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
234 OnAcceleratedSurfaceSetIOSurface) 234 OnAcceleratedSurfaceSetIOSurface)
235 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 235 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
236 OnAcceleratedSurfaceBuffersSwapped) 236 OnAcceleratedSurfaceBuffersSwapped)
237 #elif defined(OS_WIN) 237 #elif defined(OS_WIN)
238 IPC_MESSAGE_HANDLER(GpuHostMsg_ScheduleComposite, OnScheduleComposite); 238 IPC_MESSAGE_HANDLER(GpuHostMsg_ScheduleComposite, OnScheduleComposite);
239 #endif 239 #endif
240 IPC_MESSAGE_UNHANDLED_ERROR() 240 IPC_MESSAGE_UNHANDLED_ERROR()
241 IPC_END_MESSAGE_MAP() 241 IPC_END_MESSAGE_MAP()
242 242
243 return true; 243 return true;
244 } 244 }
245 245
246 void GpuProcessHostUIShim::OnLogMessage( 246 void GpuProcessHostUIShim::OnLogMessage(
247 int level, 247 int level,
248 const std::string& header, 248 const std::string& header,
249 const std::string& message) { 249 const std::string& message) {
250 DictionaryValue* dict = new DictionaryValue(); 250 DictionaryValue* dict = new DictionaryValue();
251 dict->SetInteger("level", level); 251 dict->SetInteger("level", level);
252 dict->SetString("header", header); 252 dict->SetString("header", header);
253 dict->SetString("message", message); 253 dict->SetString("message", message);
254 GpuDataManager::GetInstance()->AddLogMessage(dict); 254 GpuDataManager::GetInstance()->AddLogMessage(dict);
255 } 255 }
256 256
257 #if defined(OS_LINUX) && !defined(TOUCH_UI) || defined(OS_WIN)
258
259 void GpuProcessHostUIShim::OnResizeView(int32 renderer_id,
260 int32 render_view_id,
261 int32 command_buffer_route_id,
262 gfx::Size size) {
263 RenderViewHost* host = RenderViewHost::FromID(renderer_id,
264 render_view_id);
jam 2011/04/27 20:45:22 nit: looks like this can all fit on one line
apatrick_chromium 2011/04/27 22:45:22 Done.
265 if (host) {
266 RenderWidgetHostView* view = host->view();
267 if (view) {
268 gfx::PluginWindowHandle handle = view->GetCompositingSurface();
269
270 // Resize the window synchronously. The GPU process must not issue GL
271 // calls on the command buffer until the window is the size it expects it
272 // to be.
257 #if defined(OS_LINUX) && !defined(TOUCH_UI) 273 #if defined(OS_LINUX) && !defined(TOUCH_UI)
258 274 GdkWindow* window = reinterpret_cast<GdkWindow*>(
259 void GpuProcessHostUIShim::OnResizeXID(unsigned long xid, gfx::Size size, 275 gdk_xid_table_lookup(handle));
260 IPC::Message *reply_msg) { 276 if (window) {
261 GdkWindow* window = reinterpret_cast<GdkWindow*>(gdk_xid_table_lookup(xid)); 277 Display* display = GDK_WINDOW_XDISPLAY(window);
262 if (window) { 278 gdk_window_resize(window, size.width(), size.height());
263 Display* display = GDK_WINDOW_XDISPLAY(window); 279 XSync(display, False);
264 gdk_window_resize(window, size.width(), size.height()); 280 }
265 XSync(display, False); 281 #elif defined(OS_WIN)
282 SetWindowPos(handle,
283 NULL,
284 0, 0,
285 size.width(),
286 size.height(),
287 SWP_NOSENDCHANGING | SWP_NOCOPYBITS | SWP_NOZORDER |
288 SWP_NOACTIVATE | SWP_DEFERERASE | SWP_SHOWWINDOW);
289 #endif
290 }
266 } 291 }
267 292
268 GpuHostMsg_ResizeXID::WriteReplyParams(reply_msg, (window != NULL)); 293 // Always respond even if the window no longer exists. The GPU process cannot
269 Send(reply_msg); 294 // make progress on the resizing command buffer until it receives the
295 // response.
296 Send(new GpuMsg_ResizeViewACK(renderer_id, command_buffer_route_id));
270 } 297 }
271 298
272 #elif defined(OS_MACOSX) 299 #elif defined(OS_MACOSX)
273 300
274 void GpuProcessHostUIShim::OnAcceleratedSurfaceSetIOSurface( 301 void GpuProcessHostUIShim::OnAcceleratedSurfaceSetIOSurface(
275 const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params) { 302 const GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params& params) {
276 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id, 303 RenderViewHost* host = RenderViewHost::FromID(params.renderer_id,
277 params.render_view_id); 304 params.render_view_id);
278 if (!host) 305 if (!host)
279 return; 306 return;
(...skipping 19 matching lines...) Expand all
299 // Parameters needed to swap the IOSurface. 326 // Parameters needed to swap the IOSurface.
300 params.window, 327 params.window,
301 params.surface_id, 328 params.surface_id,
302 // Parameters needed to formulate an acknowledgment. 329 // Parameters needed to formulate an acknowledgment.
303 params.renderer_id, 330 params.renderer_id,
304 params.route_id, 331 params.route_id,
305 host_id_, 332 host_id_,
306 params.swap_buffers_count); 333 params.swap_buffers_count);
307 } 334 }
308 335
309 #elif defined(OS_WIN) 336 #endif
337
338 #if defined(OS_WIN)
310 339
311 void GpuProcessHostUIShim::OnScheduleComposite(int renderer_id, 340 void GpuProcessHostUIShim::OnScheduleComposite(int renderer_id,
312 int render_view_id) { 341 int render_view_id) {
313 RenderViewHost* host = RenderViewHost::FromID(renderer_id, 342 RenderViewHost* host = RenderViewHost::FromID(renderer_id,
314 render_view_id); 343 render_view_id);
315 if (!host) { 344 if (!host) {
316 return; 345 return;
317 } 346 }
318 host->ScheduleComposite(); 347 host->ScheduleComposite();
319 } 348 }
320 349
321 #endif 350 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698