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

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

Issue 1256613002: Add tracing for GL texture objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browser_process_id
Patch Set: Created 5 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/hash.h" 8 #include "base/hash.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 int32 end; 57 int32 end;
58 scoped_ptr<IPC::Message> reply; 58 scoped_ptr<IPC::Message> reply;
59 }; 59 };
60 60
61 namespace { 61 namespace {
62 62
63 // The GpuCommandBufferMemoryTracker class provides a bridge between the 63 // The GpuCommandBufferMemoryTracker class provides a bridge between the
64 // ContextGroup's memory type managers and the GpuMemoryManager class. 64 // ContextGroup's memory type managers and the GpuMemoryManager class.
65 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { 65 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker {
66 public: 66 public:
67 explicit GpuCommandBufferMemoryTracker(GpuChannel* channel) : 67 explicit GpuCommandBufferMemoryTracker(GpuChannel* channel)
68 tracking_group_(channel->gpu_channel_manager()->gpu_memory_manager()-> 68 : tracking_group_(
69 CreateTrackingGroup(channel->renderer_pid(), this)) { 69 channel->gpu_channel_manager()
70 } 70 ->gpu_memory_manager()
71 ->CreateTrackingGroup(channel->renderer_pid(), this)),
72 client_tracing_id_(channel->client_tracing_id()) {}
71 73
72 void TrackMemoryAllocatedChange( 74 void TrackMemoryAllocatedChange(
73 size_t old_size, 75 size_t old_size,
74 size_t new_size, 76 size_t new_size,
75 gpu::gles2::MemoryTracker::Pool pool) override { 77 gpu::gles2::MemoryTracker::Pool pool) override {
76 tracking_group_->TrackMemoryAllocatedChange( 78 tracking_group_->TrackMemoryAllocatedChange(
77 old_size, new_size, pool); 79 old_size, new_size, pool);
78 } 80 }
79 81
80 bool EnsureGPUMemoryAvailable(size_t size_needed) override { 82 bool EnsureGPUMemoryAvailable(size_t size_needed) override {
81 return tracking_group_->EnsureGPUMemoryAvailable(size_needed); 83 return tracking_group_->EnsureGPUMemoryAvailable(size_needed);
82 }; 84 };
83 85
86 uint64_t ClientTracingId() override { return client_tracing_id_; }
87
84 private: 88 private:
85 ~GpuCommandBufferMemoryTracker() override {} 89 ~GpuCommandBufferMemoryTracker() override {}
86 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; 90 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_;
91 uint64_t client_tracing_id_;
87 92
88 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); 93 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker);
89 }; 94 };
90 95
91 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the 96 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the
92 // url_hash matches. 97 // url_hash matches.
93 void FastSetActiveURL(const GURL& url, size_t url_hash) { 98 void FastSetActiveURL(const GURL& url, size_t url_hash) {
94 // Leave the previously set URL in the empty case -- empty URLs are given by 99 // Leave the previously set URL in the empty case -- empty URLs are given by
95 // BlinkPlatformImpl::createOffscreenGraphicsContext3D. Hopefully the 100 // BlinkPlatformImpl::createOffscreenGraphicsContext3D. Hopefully the
96 // onscreen context URL was set previously and will show up even when a crash 101 // onscreen context URL was set previously and will show up even when a crash
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 result)); 1161 result));
1157 } 1162 }
1158 1163
1159 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, 1164 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase,
1160 base::TimeDelta interval) { 1165 base::TimeDelta interval) {
1161 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, 1166 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase,
1162 interval)); 1167 interval));
1163 } 1168 }
1164 1169
1165 } // namespace content 1170 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698