| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 CreateTrackingGroup(channel->renderer_pid(), this)) { | 49 CreateTrackingGroup(channel->renderer_pid(), this)) { |
| 50 } | 50 } |
| 51 | 51 |
| 52 void TrackMemoryAllocatedChange(size_t old_size, | 52 void TrackMemoryAllocatedChange(size_t old_size, |
| 53 size_t new_size, | 53 size_t new_size, |
| 54 gpu::gles2::MemoryTracker::Pool pool) { | 54 gpu::gles2::MemoryTracker::Pool pool) { |
| 55 tracking_group_->TrackMemoryAllocatedChange( | 55 tracking_group_->TrackMemoryAllocatedChange( |
| 56 old_size, new_size, pool); | 56 old_size, new_size, pool); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual bool EnsureGPUMemoryAvailable(size_t size_needed) { |
| 60 return tracking_group_->EnsureGPUMemoryAvailable(size_needed); |
| 61 }; |
| 62 |
| 59 private: | 63 private: |
| 60 ~GpuCommandBufferMemoryTracker() { | 64 ~GpuCommandBufferMemoryTracker() { |
| 61 } | 65 } |
| 62 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; | 66 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; |
| 63 | 67 |
| 64 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); | 68 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the | 71 // FastSetActiveURL will shortcut the expensive call to SetActiveURL when the |
| 68 // url_hash matches. | 72 // url_hash matches. |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 route_id_, allocation.renderer_allocation)); | 869 route_id_, allocation.renderer_allocation)); |
| 866 // This can be called outside of OnMessageReceived, so the context needs to be | 870 // This can be called outside of OnMessageReceived, so the context needs to be |
| 867 // made current before calling methods on the surface. | 871 // made current before calling methods on the surface. |
| 868 if (!surface_ || !MakeCurrent()) | 872 if (!surface_ || !MakeCurrent()) |
| 869 return; | 873 return; |
| 870 surface_->SetFrontbufferAllocation( | 874 surface_->SetFrontbufferAllocation( |
| 871 allocation.browser_allocation.suggest_have_frontbuffer); | 875 allocation.browser_allocation.suggest_have_frontbuffer); |
| 872 } | 876 } |
| 873 | 877 |
| 874 } // namespace content | 878 } // namespace content |
| OLD | NEW |