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

Side by Side Diff: chrome/gpu/gpu_command_buffer_stub.cc

Issue 6076005: Mac: Don't hang gpu process on popup close under certain conditions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: final touches Created 9 years, 12 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) 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/process_util.h" 7 #include "base/process_util.h"
8 #include "base/shared_memory.h" 8 #include "base/shared_memory.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/common/child_thread.h" 10 #include "chrome/common/child_thread.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 *state = command_buffer_->GetState(); 274 *state = command_buffer_->GetState();
275 } 275 }
276 276
277 void GpuCommandBufferStub::OnAsyncGetState() { 277 void GpuCommandBufferStub::OnAsyncGetState() {
278 gpu::CommandBuffer::State state = command_buffer_->GetState(); 278 gpu::CommandBuffer::State state = command_buffer_->GetState();
279 Send(new GpuCommandBufferMsg_UpdateState(route_id_, state)); 279 Send(new GpuCommandBufferMsg_UpdateState(route_id_, state));
280 } 280 }
281 281
282 void GpuCommandBufferStub::OnFlush(int32 put_offset, 282 void GpuCommandBufferStub::OnFlush(int32 put_offset,
283 gpu::CommandBuffer::State* state) { 283 gpu::CommandBuffer::State* state) {
284 #if defined(OS_MACOSX)
285 // See comment in |DidDestroySurface()| in gpu_processor_mac.cc.
286 if (channel_->IsRenderViewGone(render_view_id_))
287 processor_->DidDestroySurface();
288 #endif
284 *state = command_buffer_->Flush(put_offset); 289 *state = command_buffer_->Flush(put_offset);
285 } 290 }
286 291
287 void GpuCommandBufferStub::OnAsyncFlush(int32 put_offset) { 292 void GpuCommandBufferStub::OnAsyncFlush(int32 put_offset) {
288 gpu::CommandBuffer::State state = command_buffer_->Flush(put_offset); 293 gpu::CommandBuffer::State state = command_buffer_->Flush(put_offset);
289 Send(new GpuCommandBufferMsg_UpdateState(route_id_, state)); 294 Send(new GpuCommandBufferMsg_UpdateState(route_id_, state));
290 } 295 }
291 296
292 void GpuCommandBufferStub::OnCreateTransferBuffer(int32 size, int32* id) { 297 void GpuCommandBufferStub::OnCreateTransferBuffer(int32 size, int32* id) {
293 *id = command_buffer_->CreateTransferBuffer(size); 298 *id = command_buffer_->CreateTransferBuffer(size);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 351
347 void GpuCommandBufferStub::SwapBuffersCallback() { 352 void GpuCommandBufferStub::SwapBuffersCallback() {
348 OnSwapBuffers(); 353 OnSwapBuffers();
349 ChildThread* gpu_thread = ChildThread::current(); 354 ChildThread* gpu_thread = ChildThread::current();
350 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; 355 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params;
351 params.renderer_id = renderer_id_; 356 params.renderer_id = renderer_id_;
352 params.render_view_id = render_view_id_; 357 params.render_view_id = render_view_id_;
353 params.window = handle_; 358 params.window = handle_;
354 params.surface_id = processor_->GetSurfaceId(); 359 params.surface_id = processor_->GetSurfaceId();
355 params.route_id = route_id(); 360 params.route_id = route_id();
356 #if defined(OS_MACOSX)
357 params.swap_buffers_count = processor_->swap_buffers_count(); 361 params.swap_buffers_count = processor_->swap_buffers_count();
358 #endif // defined(OS_MACOSX)
359 gpu_thread->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); 362 gpu_thread->Send(new GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params));
360 } 363 }
361 364
362 void GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped( 365 void GpuCommandBufferStub::AcceleratedSurfaceBuffersSwapped(
363 uint64 swap_buffers_count) { 366 uint64 swap_buffers_count) {
364 processor_->set_acknowledged_swap_buffers_count(swap_buffers_count); 367 processor_->set_acknowledged_swap_buffers_count(swap_buffers_count);
365 // Wake up the GpuProcessor to start doing work again. 368 // Wake up the GpuProcessor to start doing work again.
366 processor_->ScheduleProcessCommands(); 369 processor_->ScheduleProcessCommands();
367 } 370 }
368 #endif // defined(OS_MACOSX) 371 #endif // defined(OS_MACOSX)
369 372
370 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) { 373 void GpuCommandBufferStub::ResizeCallback(gfx::Size size) {
371 if (handle_ == gfx::kNullPluginWindow) 374 if (handle_ == gfx::kNullPluginWindow)
372 return; 375 return;
373 376
374 #if defined(OS_LINUX) 377 #if defined(OS_LINUX)
375 ChildThread* gpu_thread = ChildThread::current(); 378 ChildThread* gpu_thread = ChildThread::current();
376 bool result = false; 379 bool result = false;
377 gpu_thread->Send( 380 gpu_thread->Send(
378 new GpuHostMsg_ResizeXID(handle_, size, &result)); 381 new GpuHostMsg_ResizeXID(handle_, size, &result));
379 #elif defined(OS_WIN) 382 #elif defined(OS_WIN)
380 HWND hwnd = static_cast<HWND>(compositor_window_); 383 HWND hwnd = static_cast<HWND>(compositor_window_);
381 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS | 384 UINT swp_flags = SWP_NOSENDCHANGING | SWP_NOOWNERZORDER | SWP_NOCOPYBITS |
382 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE; 385 SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_DEFERERASE;
383 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags); 386 SetWindowPos(hwnd, NULL, 0, 0, size.width(), size.height(), swp_flags);
384 #endif // defined(OS_LINUX) 387 #endif // defined(OS_LINUX)
385 } 388 }
386 389
387 #endif // defined(ENABLE_GPU) 390 #endif // defined(ENABLE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698