OLD | NEW |
---|---|
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 Loading... | |
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()), | |
73 client_id_(channel->client_id()) {} | |
71 | 74 |
72 void TrackMemoryAllocatedChange( | 75 void TrackMemoryAllocatedChange( |
73 size_t old_size, | 76 size_t old_size, |
74 size_t new_size, | 77 size_t new_size, |
75 gpu::gles2::MemoryTracker::Pool pool) override { | 78 gpu::gles2::MemoryTracker::Pool pool) override { |
76 tracking_group_->TrackMemoryAllocatedChange( | 79 tracking_group_->TrackMemoryAllocatedChange( |
77 old_size, new_size, pool); | 80 old_size, new_size, pool); |
78 } | 81 } |
79 | 82 |
80 bool EnsureGPUMemoryAvailable(size_t size_needed) override { | 83 bool EnsureGPUMemoryAvailable(size_t size_needed) override { |
81 return tracking_group_->EnsureGPUMemoryAvailable(size_needed); | 84 return tracking_group_->EnsureGPUMemoryAvailable(size_needed); |
82 }; | 85 }; |
83 | 86 |
87 uint64_t ClientTracingId() override { return client_tracing_id_; } | |
petrcermak
2015/07/29 16:13:34
const?
ericrk
2015/07/29 18:46:46
Done.
| |
88 int ClientId() override { return client_id_; } | |
petrcermak
2015/07/29 16:13:34
ditto
ericrk
2015/07/29 18:46:46
Done.
| |
89 | |
84 private: | 90 private: |
85 ~GpuCommandBufferMemoryTracker() override {} | 91 ~GpuCommandBufferMemoryTracker() override {} |
86 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; | 92 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; |
93 uint64_t client_tracing_id_; | |
petrcermak
2015/07/29 16:13:34
const?
ericrk
2015/07/29 18:46:46
Done.
| |
94 int client_id_; | |
petrcermak
2015/07/29 16:13:34
ditto
ericrk
2015/07/29 18:46:46
Done.
| |
87 | 95 |
88 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); | 96 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); |
89 }; | 97 }; |
90 | 98 |
91 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the | 99 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the |
92 // url_hash matches. | 100 // url_hash matches. |
93 void FastSetActiveURL(const GURL& url, size_t url_hash) { | 101 void FastSetActiveURL(const GURL& url, size_t url_hash) { |
94 // Leave the previously set URL in the empty case -- empty URLs are given by | 102 // Leave the previously set URL in the empty case -- empty URLs are given by |
95 // BlinkPlatformImpl::createOffscreenGraphicsContext3D. Hopefully the | 103 // BlinkPlatformImpl::createOffscreenGraphicsContext3D. Hopefully the |
96 // onscreen context URL was set previously and will show up even when a crash | 104 // 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 Loading... | |
1156 result)); | 1164 result)); |
1157 } | 1165 } |
1158 | 1166 |
1159 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1167 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
1160 base::TimeDelta interval) { | 1168 base::TimeDelta interval) { |
1161 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1169 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
1162 interval)); | 1170 interval)); |
1163 } | 1171 } |
1164 | 1172 |
1165 } // namespace content | 1173 } // namespace content |
OLD | NEW |