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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 10796096: Add tracing of all memory allocated in all contexts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More trybot constructor fixes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/common/gpu/gpu_memory_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index e83be95cfea4af7d5d37b64088364984dd75caac..15302bfaed2392f492ffb44c96bb6e8e1ed60add 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -23,6 +23,7 @@
#include "content/public/common/content_client.h"
#include "gpu/command_buffer/common/constants.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
+#include "gpu/command_buffer/service/memory_tracking.h"
#include "net/disk_cache/hash.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_switches.h"
@@ -33,6 +34,23 @@
namespace {
+// The GpuCommandBufferMemoryTracker class provides a bridge between the
+// ContextGroup's memory type managers and the GpuMemoryManager class.
+class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker {
+ public:
+ GpuCommandBufferMemoryTracker(GpuMemoryManager* gpu_memory_manager)
+ : gpu_memory_manager_(gpu_memory_manager) {}
+ void TrackMemoryAllocatedChange(size_t old_size, size_t new_size) {
+ gpu_memory_manager_->TrackMemoryAllocatedChange(old_size, new_size);
+ }
+
+ private:
+ ~GpuCommandBufferMemoryTracker() {}
+ GpuMemoryManager* gpu_memory_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker);
+};
+
// FastSetActiveURL will shortcut the expensive call to SetActiveURL when the
// url_hash matches.
void FastSetActiveURL(const GURL& url, size_t url_hash) {
@@ -103,7 +121,11 @@ GpuCommandBufferStub::GpuCommandBufferStub(
if (share_group) {
context_group_ = share_group->context_group_;
} else {
- context_group_ = new gpu::gles2::ContextGroup(mailbox_manager, true);
+ context_group_ = new gpu::gles2::ContextGroup(
+ mailbox_manager,
+ new GpuCommandBufferMemoryTracker(
+ channel->gpu_channel_manager()->gpu_memory_manager()),
+ true);
}
if (surface_id != 0)
surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState(
« no previous file with comments | « no previous file | content/common/gpu/gpu_memory_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698