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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // The GpuCommandBufferMemoryTracker class provides a bridge between the | 43 // The GpuCommandBufferMemoryTracker class provides a bridge between the |
44 // ContextGroup's memory type managers and the GpuMemoryManager class. | 44 // ContextGroup's memory type managers and the GpuMemoryManager class. |
45 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { | 45 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { |
46 public: | 46 public: |
47 explicit GpuCommandBufferMemoryTracker(GpuChannel* channel) : | 47 explicit GpuCommandBufferMemoryTracker(GpuChannel* channel) : |
48 tracking_group_(channel->gpu_channel_manager()->gpu_memory_manager()-> | 48 tracking_group_(channel->gpu_channel_manager()->gpu_memory_manager()-> |
49 CreateTrackingGroup(channel->renderer_pid(), this)) { | 49 CreateTrackingGroup(channel->renderer_pid(), this)) { |
50 } | 50 } |
51 | 51 |
52 void TrackMemoryAllocatedChange(size_t old_size, | 52 virtual void TrackMemoryAllocatedChange( |
53 size_t new_size, | 53 size_t old_size, |
54 gpu::gles2::MemoryTracker::Pool pool) { | 54 size_t new_size, |
| 55 gpu::gles2::MemoryTracker::Pool pool) OVERRIDE { |
55 tracking_group_->TrackMemoryAllocatedChange( | 56 tracking_group_->TrackMemoryAllocatedChange( |
56 old_size, new_size, pool); | 57 old_size, new_size, pool); |
57 } | 58 } |
58 | 59 |
59 virtual bool EnsureGPUMemoryAvailable(size_t size_needed) { | 60 virtual bool EnsureGPUMemoryAvailable(size_t size_needed) OVERRIDE { |
60 return tracking_group_->EnsureGPUMemoryAvailable(size_needed); | 61 return tracking_group_->EnsureGPUMemoryAvailable(size_needed); |
61 }; | 62 }; |
62 | 63 |
63 private: | 64 private: |
64 ~GpuCommandBufferMemoryTracker() { | 65 virtual ~GpuCommandBufferMemoryTracker() { |
65 } | 66 } |
66 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; | 67 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); | 69 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); |
69 }; | 70 }; |
70 | 71 |
71 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the | 72 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the |
72 // url_hash matches. | 73 // url_hash matches. |
73 void FastSetActiveURL(const GURL& url, size_t url_hash) { | 74 void FastSetActiveURL(const GURL& url, size_t url_hash) { |
74 // Leave the previously set URL in the empty case -- empty URLs are given by | 75 // Leave the previously set URL in the empty case -- empty URLs are given by |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 if (surface_ && MakeCurrent()) | 875 if (surface_ && MakeCurrent()) |
875 surface_->SetFrontbufferAllocation( | 876 surface_->SetFrontbufferAllocation( |
876 allocation.browser_allocation.suggest_have_frontbuffer); | 877 allocation.browser_allocation.suggest_have_frontbuffer); |
877 } | 878 } |
878 | 879 |
879 last_memory_allocation_valid_ = true; | 880 last_memory_allocation_valid_ = true; |
880 last_memory_allocation_ = allocation; | 881 last_memory_allocation_ = allocation; |
881 } | 882 } |
882 | 883 |
883 } // namespace content | 884 } // namespace content |
OLD | NEW |