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

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: Add global memory usage tracking 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
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 6a281e4169071af8cb204994d542fb7c4e9c14b2..c32162a0acff76cdc0e460cead9365195f1f5422 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,20 @@
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:
+ GpuMemoryManager* gpu_memory_manager_;
+};
+
// FastSetActiveURL will shortcut the expensive call to SetActiveURL when the
// url_hash matches.
void FastSetActiveURL(const GURL& url, size_t url_hash) {
@@ -103,7 +118,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') | gpu/command_buffer/service/memory_tracking.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698