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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 10702200: PyAuto test for GPU memory consumption (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated PyAuto test for GPU memory consumption. Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 442
443 return process_->Send(msg); 443 return process_->Send(msg);
444 } 444 }
445 445
446 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { 446 bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
447 DCHECK(CalledOnValidThread()); 447 DCHECK(CalledOnValidThread());
448 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) 448 IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
449 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished) 449 IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
450 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) 450 IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated)
451 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) 451 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer)
452 IPC_MESSAGE_HANDLER(GpuHostMsg_MemStats, OnMemStats)
452 #if defined(OS_MACOSX) 453 #if defined(OS_MACOSX)
453 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 454 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
454 OnAcceleratedSurfaceBuffersSwapped) 455 OnAcceleratedSurfaceBuffersSwapped)
455 #endif 456 #endif
456 #if defined(OS_WIN) && !defined(USE_AURA) 457 #if defined(OS_WIN) && !defined(USE_AURA)
457 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 458 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
458 OnAcceleratedSurfaceBuffersSwapped) 459 OnAcceleratedSurfaceBuffersSwapped)
459 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer, 460 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfacePostSubBuffer,
460 OnAcceleratedSurfacePostSubBuffer) 461 OnAcceleratedSurfacePostSubBuffer)
461 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend, 462 IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceSuspend,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) { 582 void GpuProcessHost::OnDestroyCommandBuffer(int32 surface_id) {
582 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnDestroyCommandBuffer"); 583 TRACE_EVENT0("gpu", "GpuProcessHostUIShim::OnDestroyCommandBuffer");
583 584
584 #if defined(TOOLKIT_GTK) 585 #if defined(TOOLKIT_GTK)
585 SurfaceRefMap::iterator it = surface_refs_.find(surface_id); 586 SurfaceRefMap::iterator it = surface_refs_.find(surface_id);
586 if (it != surface_refs_.end()) 587 if (it != surface_refs_.end())
587 surface_refs_.erase(it); 588 surface_refs_.erase(it);
588 #endif // defined(TOOLKIT_GTK) 589 #endif // defined(TOOLKIT_GTK)
589 } 590 }
590 591
592 void GpuProcessHost::SetOnMemStatsCallback(OnMemStatsCallback callback)
593 {
594 DCHECK(on_mem_stats_callback_.is_null());
595 on_mem_stats_callback_ = callback;
596 }
597
598 void GpuProcessHost::OnMemStats(content::GpuMemStats mem_stats) {
599 DCHECK(!on_mem_stats_callback_.is_null());
600 on_mem_stats_callback_.Run(mem_stats);
601 on_mem_stats_callback_.Reset();
602 }
603
591 #if defined(OS_MACOSX) 604 #if defined(OS_MACOSX)
592 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( 605 void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped(
593 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { 606 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) {
594 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped"); 607 TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped");
595 608
596 gfx::PluginWindowHandle handle = 609 gfx::PluginWindowHandle handle =
597 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); 610 GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id);
598 // Compositor window is always gfx::kNullPluginWindow. 611 // Compositor window is always gfx::kNullPluginWindow.
599 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no 612 // TODO(jbates) http://crbug.com/105344 This will be removed when there are no
600 // plugin windows. 613 // plugin windows.
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 const IPC::ChannelHandle& channel_handle, 870 const IPC::ChannelHandle& channel_handle,
858 base::ProcessHandle renderer_process_for_gpu, 871 base::ProcessHandle renderer_process_for_gpu,
859 const content::GPUInfo& gpu_info) { 872 const content::GPUInfo& gpu_info) {
860 callback.Run(channel_handle, gpu_info); 873 callback.Run(channel_handle, gpu_info);
861 } 874 }
862 875
863 void GpuProcessHost::CreateCommandBufferError( 876 void GpuProcessHost::CreateCommandBufferError(
864 const CreateCommandBufferCallback& callback, int32 route_id) { 877 const CreateCommandBufferCallback& callback, int32 route_id) {
865 callback.Run(route_id); 878 callback.Run(route_id);
866 } 879 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698