| 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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { | 63 class GpuCommandBufferMemoryTracker : public gpu::gles2::MemoryTracker { |
| 64 public: | 64 public: |
| 65 explicit GpuCommandBufferMemoryTracker(GpuChannel* channel) : | 65 explicit GpuCommandBufferMemoryTracker(GpuChannel* channel) : |
| 66 tracking_group_(channel->gpu_channel_manager()->gpu_memory_manager()-> | 66 tracking_group_(channel->gpu_channel_manager()->gpu_memory_manager()-> |
| 67 CreateTrackingGroup(channel->renderer_pid(), this)) { | 67 CreateTrackingGroup(channel->renderer_pid(), this)) { |
| 68 } | 68 } |
| 69 | 69 |
| 70 virtual void TrackMemoryAllocatedChange( | 70 virtual void TrackMemoryAllocatedChange( |
| 71 size_t old_size, | 71 size_t old_size, |
| 72 size_t new_size, | 72 size_t new_size, |
| 73 gpu::gles2::MemoryTracker::Pool pool) OVERRIDE { | 73 gpu::gles2::MemoryTracker::Pool pool) override { |
| 74 tracking_group_->TrackMemoryAllocatedChange( | 74 tracking_group_->TrackMemoryAllocatedChange( |
| 75 old_size, new_size, pool); | 75 old_size, new_size, pool); |
| 76 } | 76 } |
| 77 | 77 |
| 78 virtual bool EnsureGPUMemoryAvailable(size_t size_needed) OVERRIDE { | 78 virtual bool EnsureGPUMemoryAvailable(size_t size_needed) override { |
| 79 return tracking_group_->EnsureGPUMemoryAvailable(size_needed); | 79 return tracking_group_->EnsureGPUMemoryAvailable(size_needed); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 virtual ~GpuCommandBufferMemoryTracker() { | 83 virtual ~GpuCommandBufferMemoryTracker() { |
| 84 } | 84 } |
| 85 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; | 85 scoped_ptr<GpuMemoryTrackingGroup> tracking_group_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); | 87 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferMemoryTracker); |
| 88 }; | 88 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 110 const int64 kHandleMoreWorkPeriodBusyMs = 1; | 110 const int64 kHandleMoreWorkPeriodBusyMs = 1; |
| 111 | 111 |
| 112 // Prevents idle work from being starved. | 112 // Prevents idle work from being starved. |
| 113 const int64 kMaxTimeSinceIdleMs = 10; | 113 const int64 kMaxTimeSinceIdleMs = 10; |
| 114 | 114 |
| 115 class DevToolsChannelData : public base::debug::ConvertableToTraceFormat { | 115 class DevToolsChannelData : public base::debug::ConvertableToTraceFormat { |
| 116 public: | 116 public: |
| 117 static scoped_refptr<base::debug::ConvertableToTraceFormat> CreateForChannel( | 117 static scoped_refptr<base::debug::ConvertableToTraceFormat> CreateForChannel( |
| 118 GpuChannel* channel); | 118 GpuChannel* channel); |
| 119 | 119 |
| 120 virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE { | 120 virtual void AppendAsTraceFormat(std::string* out) const override { |
| 121 std::string tmp; | 121 std::string tmp; |
| 122 base::JSONWriter::Write(value_.get(), &tmp); | 122 base::JSONWriter::Write(value_.get(), &tmp); |
| 123 *out += tmp; | 123 *out += tmp; |
| 124 } | 124 } |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 explicit DevToolsChannelData(base::Value* value) : value_(value) {} | 127 explicit DevToolsChannelData(base::Value* value) : value_(value) {} |
| 128 virtual ~DevToolsChannelData() {} | 128 virtual ~DevToolsChannelData() {} |
| 129 scoped_ptr<base::Value> value_; | 129 scoped_ptr<base::Value> value_; |
| 130 DISALLOW_COPY_AND_ASSIGN(DevToolsChannelData); | 130 DISALLOW_COPY_AND_ASSIGN(DevToolsChannelData); |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 if (decoder_) | 1090 if (decoder_) |
| 1091 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 1091 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 1092 command_buffer_->SetParseError(gpu::error::kLostContext); | 1092 command_buffer_->SetParseError(gpu::error::kLostContext); |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1095 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
| 1096 return GetMemoryManager()->GetClientMemoryUsage(this); | 1096 return GetMemoryManager()->GetClientMemoryUsage(this); |
| 1097 } | 1097 } |
| 1098 | 1098 |
| 1099 } // namespace content | 1099 } // namespace content |
| OLD | NEW |