| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // The first time polling a fence, delay some extra time to allow other | 105 // The first time polling a fence, delay some extra time to allow other |
| 106 // stubs to process some work, or else the timing of the fences could | 106 // stubs to process some work, or else the timing of the fences could |
| 107 // allow a pattern of alternating fast and slow frames to occur. | 107 // allow a pattern of alternating fast and slow frames to occur. |
| 108 const int64 kHandleMoreWorkPeriodMs = 2; | 108 const int64 kHandleMoreWorkPeriodMs = 2; |
| 109 const int64 kHandleMoreWorkPeriodBusyMs = 1; | 109 const int64 kHandleMoreWorkPeriodBusyMs = 1; |
| 110 | 110 |
| 111 // Prevents idle work from being starved. | 111 // Prevents idle work from being starved. |
| 112 const int64 kMaxTimeSinceIdleMs = 10; | 112 const int64 kMaxTimeSinceIdleMs = 10; |
| 113 | 113 |
| 114 class DevToolsChannelData : public base::debug::ConvertableToTraceFormat { | 114 class DevToolsChannelData : public base::trace_event::ConvertableToTraceFormat { |
| 115 public: | 115 public: |
| 116 static scoped_refptr<base::debug::ConvertableToTraceFormat> CreateForChannel( | 116 static scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 117 GpuChannel* channel); | 117 CreateForChannel(GpuChannel* channel); |
| 118 | 118 |
| 119 void AppendAsTraceFormat(std::string* out) const override { | 119 void AppendAsTraceFormat(std::string* out) const override { |
| 120 std::string tmp; | 120 std::string tmp; |
| 121 base::JSONWriter::Write(value_.get(), &tmp); | 121 base::JSONWriter::Write(value_.get(), &tmp); |
| 122 *out += tmp; | 122 *out += tmp; |
| 123 } | 123 } |
| 124 | 124 |
| 125 private: | 125 private: |
| 126 explicit DevToolsChannelData(base::Value* value) : value_(value) {} | 126 explicit DevToolsChannelData(base::Value* value) : value_(value) {} |
| 127 ~DevToolsChannelData() override {} | 127 ~DevToolsChannelData() override {} |
| 128 scoped_ptr<base::Value> value_; | 128 scoped_ptr<base::Value> value_; |
| 129 DISALLOW_COPY_AND_ASSIGN(DevToolsChannelData); | 129 DISALLOW_COPY_AND_ASSIGN(DevToolsChannelData); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 scoped_refptr<base::debug::ConvertableToTraceFormat> | 132 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 133 DevToolsChannelData::CreateForChannel(GpuChannel* channel) { | 133 DevToolsChannelData::CreateForChannel(GpuChannel* channel) { |
| 134 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue); | 134 scoped_ptr<base::DictionaryValue> res(new base::DictionaryValue); |
| 135 res->SetInteger("renderer_pid", channel->renderer_pid()); | 135 res->SetInteger("renderer_pid", channel->renderer_pid()); |
| 136 res->SetDouble("used_bytes", channel->GetMemoryUsage()); | 136 res->SetDouble("used_bytes", channel->GetMemoryUsage()); |
| 137 res->SetDouble("limit_bytes", | 137 res->SetDouble("limit_bytes", |
| 138 channel->gpu_channel_manager() | 138 channel->gpu_channel_manager() |
| 139 ->gpu_memory_manager() | 139 ->gpu_memory_manager() |
| 140 ->GetMaximumClientAllocation()); | 140 ->GetMaximumClientAllocation()); |
| 141 return new DevToolsChannelData(res.release()); | 141 return new DevToolsChannelData(res.release()); |
| 142 } | 142 } |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1081 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
| 1082 return GetMemoryManager()->GetClientMemoryUsage(this); | 1082 return GetMemoryManager()->GetClientMemoryUsage(this); |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 void GpuCommandBufferStub::SwapBuffersCompleted( | 1085 void GpuCommandBufferStub::SwapBuffersCompleted( |
| 1086 const std::vector<ui::LatencyInfo>& latency_info) { | 1086 const std::vector<ui::LatencyInfo>& latency_info) { |
| 1087 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); | 1087 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, latency_info)); |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 } // namespace content | 1090 } // namespace content |
| OLD | NEW |