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

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

Issue 5275009: Defer window destruction until GPU finished drawing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with reference counting. Created 10 years 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
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | chrome/common/gpu_messages_internal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/gpu_process_host.h" 5 #include "chrome/browser/gpu_process_host.h"
6 6
7 #include "app/app_switches.h" 7 #include "app/app_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 GpuProcessHost::SynchronizationRequest::~SynchronizationRequest() {} 164 GpuProcessHost::SynchronizationRequest::~SynchronizationRequest() {}
165 165
166 void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) { 166 void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) {
167 DCHECK(CalledOnValidThread()); 167 DCHECK(CalledOnValidThread());
168 168
169 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 169 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
170 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 170 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
171 IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply) 171 IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply)
172 #if defined(OS_LINUX) 172 #if defined(OS_LINUX)
173 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetViewXID, OnGetViewXID) 173 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_GetViewXID, OnGetViewXID)
174 IPC_MESSAGE_HANDLER(GpuHostMsg_ReleaseXID, OnReleaseXID)
174 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_ResizeXID, OnResizeXID) 175 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_ResizeXID, OnResizeXID)
175 #elif defined(OS_MACOSX) 176 #elif defined(OS_MACOSX)
176 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface, 177 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSetIOSurface,
177 OnAcceleratedSurfaceSetIOSurface) 178 OnAcceleratedSurfaceSetIOSurface)
178 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 179 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
179 OnAcceleratedSurfaceBuffersSwapped) 180 OnAcceleratedSurfaceBuffersSwapped)
180 #elif defined(OS_WIN) 181 #elif defined(OS_WIN)
181 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_CreateCompositorHostWindow, 182 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuHostMsg_CreateCompositorHostWindow,
182 OnCreateCompositorHostWindow) 183 OnCreateCompositorHostWindow)
183 #endif 184 #endif
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 222 }
222 223
223 GpuHostMsg_GetViewXID::WriteReplyParams(reply_msg, xid); 224 GpuHostMsg_GetViewXID::WriteReplyParams(reply_msg, xid);
224 225
225 // Have to reply from IO thread. 226 // Have to reply from IO thread.
226 BrowserThread::PostTask( 227 BrowserThread::PostTask(
227 BrowserThread::IO, FROM_HERE, 228 BrowserThread::IO, FROM_HERE,
228 NewRunnableFunction(&SendDelayedReply, reply_msg)); 229 NewRunnableFunction(&SendDelayedReply, reply_msg));
229 } 230 }
230 231
232 void ReleaseXIDDispatcher(unsigned long xid) {
233 GtkNativeViewManager* manager = Singleton<GtkNativeViewManager>::get();
234 manager->ReleasePermanentXID(xid);
235 }
236
231 void ResizeXIDDispatcher(unsigned long xid, gfx::Size size, 237 void ResizeXIDDispatcher(unsigned long xid, gfx::Size size,
232 IPC::Message *reply_msg) { 238 IPC::Message *reply_msg) {
233 GdkWindow* window = reinterpret_cast<GdkWindow*>(gdk_xid_table_lookup(xid)); 239 GdkWindow* window = reinterpret_cast<GdkWindow*>(gdk_xid_table_lookup(xid));
234 if (window) { 240 if (window) {
235 Display* display = GDK_WINDOW_XDISPLAY(window); 241 Display* display = GDK_WINDOW_XDISPLAY(window);
236 gdk_window_resize(window, size.width(), size.height()); 242 gdk_window_resize(window, size.width(), size.height());
237 XSync(display, False); 243 XSync(display, False);
238 } 244 }
239 245
240 GpuHostMsg_ResizeXID::WriteReplyParams(reply_msg, (window != NULL)); 246 GpuHostMsg_ResizeXID::WriteReplyParams(reply_msg, (window != NULL));
241 247
242 // Have to reply from IO thread. 248 // Have to reply from IO thread.
243 BrowserThread::PostTask( 249 BrowserThread::PostTask(
244 BrowserThread::IO, FROM_HERE, 250 BrowserThread::IO, FROM_HERE,
245 NewRunnableFunction(&SendDelayedReply, reply_msg)); 251 NewRunnableFunction(&SendDelayedReply, reply_msg));
246 } 252 }
247 253
248 } // namespace 254 } // namespace
249 255
250 void GpuProcessHost::OnGetViewXID(gfx::NativeViewId id, 256 void GpuProcessHost::OnGetViewXID(gfx::NativeViewId id,
251 IPC::Message *reply_msg) { 257 IPC::Message *reply_msg) {
252 // Have to request a permanent XID from UI thread. 258 // Have to request a permanent XID from UI thread.
253 BrowserThread::PostTask( 259 BrowserThread::PostTask(
254 BrowserThread::UI, FROM_HERE, 260 BrowserThread::UI, FROM_HERE,
255 NewRunnableFunction(&GetViewXIDDispatcher, id, reply_msg)); 261 NewRunnableFunction(&GetViewXIDDispatcher, id, reply_msg));
256 } 262 }
257 263
264 void GpuProcessHost::OnReleaseXID(unsigned long xid) {
265 // Have to release a permanent XID from UI thread.
266 BrowserThread::PostTask(
267 BrowserThread::UI, FROM_HERE,
268 NewRunnableFunction(&ReleaseXIDDispatcher, xid));
269 }
270
258 void GpuProcessHost::OnResizeXID(unsigned long xid, gfx::Size size, 271 void GpuProcessHost::OnResizeXID(unsigned long xid, gfx::Size size,
259 IPC::Message *reply_msg) { 272 IPC::Message *reply_msg) {
260 // Have to resize the window from UI thread. 273 // Have to resize the window from UI thread.
261 BrowserThread::PostTask( 274 BrowserThread::PostTask(
262 BrowserThread::UI, FROM_HERE, 275 BrowserThread::UI, FROM_HERE,
263 NewRunnableFunction(&ResizeXIDDispatcher, xid, size, reply_msg)); 276 NewRunnableFunction(&ResizeXIDDispatcher, xid, size, reply_msg));
264 } 277 }
265 278
266 #elif defined(OS_MACOSX) 279 #elif defined(OS_MACOSX)
267 280
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 false, // Never use the zygote (GPU plugin can't be sandboxed). 511 false, // Never use the zygote (GPU plugin can't be sandboxed).
499 base::environment_vector(), 512 base::environment_vector(),
500 #endif 513 #endif
501 cmd_line); 514 cmd_line);
502 515
503 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", 516 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",
504 kLaunched, kGPUProcessLifetimeEvent_Max); 517 kLaunched, kGPUProcessLifetimeEvent_Max);
505 return true; 518 return true;
506 } 519 }
507 520
OLDNEW
« no previous file with comments | « chrome/browser/gpu_process_host.h ('k') | chrome/common/gpu_messages_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698