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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 10854076: Add GPU memory tab to the task manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow only one outstanding vidmem refresh Created 8 years, 4 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 20 matching lines...) Expand all
31 #if defined(OS_WIN) 31 #if defined(OS_WIN)
32 #include "content/public/common/sandbox_init.h" 32 #include "content/public/common/sandbox_init.h"
33 #endif 33 #endif
34 34
35 namespace { 35 namespace {
36 36
37 // The GpuCommandBufferMemoryTracker class provides a bridge between the 37 // The GpuCommandBufferMemoryTracker class provides a bridge between the
38 // ContextGroup's memory type managers and the GpuMemoryManager class. 38 // ContextGroup's memory type managers and the GpuMemoryManager class.
39 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { 39 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker {
40 public: 40 public:
41 GpuCommandBufferMemoryTracker(GpuMemoryManager* gpu_memory_manager) 41 GpuCommandBufferMemoryTracker(GpuChannel* channel) {
ccameron 2012/08/09 20:55:39 Note that this records the first renderer's PID an
42 : gpu_memory_manager_(gpu_memory_manager) {} 42 gpu_memory_manager_tracking_group_ = new GpuMemoryTrackingGroup(
43 channel->renderer_pid(),
44 channel->gpu_channel_manager()->gpu_memory_manager());
45 }
46
43 void TrackMemoryAllocatedChange(size_t old_size, size_t new_size) { 47 void TrackMemoryAllocatedChange(size_t old_size, size_t new_size) {
44 gpu_memory_manager_->TrackMemoryAllocatedChange(old_size, new_size); 48 gpu_memory_manager_tracking_group_->TrackMemoryAllocatedChange(
49 old_size, new_size);
45 } 50 }
46 51
47 private: 52 private:
48 ~GpuCommandBufferMemoryTracker() {} 53 ~GpuCommandBufferMemoryTracker() {
49 GpuMemoryManager* gpu_memory_manager_; 54 delete gpu_memory_manager_tracking_group_;
55 }
56 GpuMemoryTrackingGroup* gpu_memory_manager_tracking_group_;
50 57
51 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); 58 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker);
52 }; 59 };
53 60
54 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the 61 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the
55 // url_hash matches. 62 // url_hash matches.
56 void FastSetActiveURL(const GURL& url, size_t url_hash) { 63 void FastSetActiveURL(const GURL& url, size_t url_hash) {
57 // Leave the previously set URL in the empty case -- empty URLs are given by 64 // Leave the previously set URL in the empty case -- empty URLs are given by
58 // WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D. Hopefully the 65 // WebKitPlatformSupportImpl::createOffscreenGraphicsContext3D. Hopefully the
59 // onscreen context URL was set previously and will show up even when a crash 66 // onscreen context URL was set previously and will show up even when a crash
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 delayed_work_scheduled_(false), 123 delayed_work_scheduled_(false),
117 active_url_(active_url) { 124 active_url_(active_url) {
118 active_url_hash_ = 125 active_url_hash_ =
119 disk_cache::Hash(active_url.possibly_invalid_spec()); 126 disk_cache::Hash(active_url.possibly_invalid_spec());
120 FastSetActiveURL(active_url_, active_url_hash_); 127 FastSetActiveURL(active_url_, active_url_hash_);
121 if (share_group) { 128 if (share_group) {
122 context_group_ = share_group->context_group_; 129 context_group_ = share_group->context_group_;
123 } else { 130 } else {
124 context_group_ = new gpu::gles2::ContextGroup( 131 context_group_ = new gpu::gles2::ContextGroup(
125 mailbox_manager, 132 mailbox_manager,
126 new GpuCommandBufferMemoryTracker( 133 new GpuCommandBufferMemoryTracker(channel),
127 channel->gpu_channel_manager()->gpu_memory_manager()),
128 true); 134 true);
129 } 135 }
130 if (surface_id != 0) 136 if (surface_id != 0)
131 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState( 137 surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState(
132 surface_id, true, base::TimeTicks::Now())); 138 surface_id, true, base::TimeTicks::Now()));
133 if (handle_.sync_point) 139 if (handle_.sync_point)
134 OnWaitSyncPoint(handle_.sync_point); 140 OnWaitSyncPoint(handle_.sync_point);
135 } 141 }
136 142
137 GpuCommandBufferStub::~GpuCommandBufferStub() { 143 GpuCommandBufferStub::~GpuCommandBufferStub() {
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 const GpuMemoryAllocation& allocation) { 831 const GpuMemoryAllocation& allocation) {
826 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation)); 832 Send(new GpuCommandBufferMsg_SetMemoryAllocation(route_id_, allocation));
827 // This can be called outside of OnMessageReceived, so the context needs to be 833 // This can be called outside of OnMessageReceived, so the context needs to be
828 // made current before calling methods on the surface. 834 // made current before calling methods on the surface.
829 if (!surface_ || !MakeCurrent()) 835 if (!surface_ || !MakeCurrent())
830 return; 836 return;
831 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer); 837 surface_->SetFrontbufferAllocation(allocation.suggest_have_frontbuffer);
832 } 838 }
833 839
834 #endif // defined(ENABLE_GPU) 840 #endif // defined(ENABLE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698