Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: gpu/command_buffer/service/gpu_tracer.h

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // This file contains the GPUTrace class. 5 // This file contains the GPUTrace class.
6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_
7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_
8 8
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <memory> 12 #include <memory>
13 #include <stack> 13 #include <stack>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/threading/thread.h" 19 #include "base/threading/thread.h"
20 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 20 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
21 #include "gpu/gpu_export.h" 21 #include "gpu/gpu_export.h"
22 22
23 namespace gfx { 23 namespace gl {
24 class GPUTimingClient; 24 class GPUTimingClient;
25 class GPUTimer; 25 class GPUTimer;
26 } 26 }
27 27
28 namespace gpu { 28 namespace gpu {
29 namespace gles2 { 29 namespace gles2 {
30 30
31 class Outputter; 31 class Outputter;
32 class GPUTrace; 32 class GPUTrace;
33 33
34 // Id used to keep trace namespaces separate 34 // Id used to keep trace namespaces separate
35 enum GpuTracerSource { 35 enum GpuTracerSource {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const std::string& CurrentCategory(GpuTracerSource source) const; 85 const std::string& CurrentCategory(GpuTracerSource source) const;
86 const std::string& CurrentName(GpuTracerSource source) const; 86 const std::string& CurrentName(GpuTracerSource source) const;
87 87
88 protected: 88 protected:
89 // Trace Processing. 89 // Trace Processing.
90 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name); 90 virtual scoped_refptr<Outputter> CreateOutputter(const std::string& name);
91 91
92 bool CheckDisjointStatus(); 92 bool CheckDisjointStatus();
93 void ClearOngoingTraces(bool have_context); 93 void ClearOngoingTraces(bool have_context);
94 94
95 scoped_refptr<gfx::GPUTimingClient> gpu_timing_client_; 95 scoped_refptr<gl::GPUTimingClient> gpu_timing_client_;
96 scoped_refptr<Outputter> outputter_; 96 scoped_refptr<Outputter> outputter_;
97 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES]; 97 std::vector<TraceMarker> markers_[NUM_TRACER_SOURCES];
98 std::deque<scoped_refptr<GPUTrace> > finished_traces_; 98 std::deque<scoped_refptr<GPUTrace> > finished_traces_;
99 99
100 const unsigned char* gpu_trace_srv_category; 100 const unsigned char* gpu_trace_srv_category;
101 const unsigned char* gpu_trace_dev_category; 101 const unsigned char* gpu_trace_dev_category;
102 gles2::GLES2Decoder* decoder_; 102 gles2::GLES2Decoder* decoder_;
103 int64_t disjoint_time_ = 0; 103 int64_t disjoint_time_ = 0;
104 104
105 bool gpu_executing_ = false; 105 bool gpu_executing_ = false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 std::stack<uint64_t> trace_service_id_stack_[NUM_TRACER_SOURCES]; 159 std::stack<uint64_t> trace_service_id_stack_[NUM_TRACER_SOURCES];
160 160
161 private: 161 private:
162 DISALLOW_COPY_AND_ASSIGN(TraceOutputter); 162 DISALLOW_COPY_AND_ASSIGN(TraceOutputter);
163 }; 163 };
164 164
165 class GPU_EXPORT GPUTrace 165 class GPU_EXPORT GPUTrace
166 : public base::RefCounted<GPUTrace> { 166 : public base::RefCounted<GPUTrace> {
167 public: 167 public:
168 GPUTrace(scoped_refptr<Outputter> outputter, 168 GPUTrace(scoped_refptr<Outputter> outputter,
169 gfx::GPUTimingClient* gpu_timing_client, 169 gl::GPUTimingClient* gpu_timing_client,
170 const GpuTracerSource source, 170 const GpuTracerSource source,
171 const std::string& category, 171 const std::string& category,
172 const std::string& name, 172 const std::string& name,
173 const bool tracing_service, 173 const bool tracing_service,
174 const bool tracing_device); 174 const bool tracing_device);
175 175
176 void Destroy(bool have_context); 176 void Destroy(bool have_context);
177 177
178 void Start(); 178 void Start();
179 void End(); 179 void End();
180 bool IsAvailable(); 180 bool IsAvailable();
181 bool IsServiceTraceEnabled() const { return service_enabled_; } 181 bool IsServiceTraceEnabled() const { return service_enabled_; }
182 bool IsDeviceTraceEnabled() const { return device_enabled_; } 182 bool IsDeviceTraceEnabled() const { return device_enabled_; }
183 void Process(); 183 void Process();
184 184
185 private: 185 private:
186 ~GPUTrace(); 186 ~GPUTrace();
187 187
188 void Output(); 188 void Output();
189 189
190 friend class base::RefCounted<GPUTrace>; 190 friend class base::RefCounted<GPUTrace>;
191 191
192 const GpuTracerSource source_ = kTraceGroupInvalid; 192 const GpuTracerSource source_ = kTraceGroupInvalid;
193 const std::string category_; 193 const std::string category_;
194 const std::string name_; 194 const std::string name_;
195 scoped_refptr<Outputter> outputter_; 195 scoped_refptr<Outputter> outputter_;
196 std::unique_ptr<gfx::GPUTimer> gpu_timer_; 196 std::unique_ptr<gl::GPUTimer> gpu_timer_;
197 const bool service_enabled_ = false; 197 const bool service_enabled_ = false;
198 const bool device_enabled_ = false; 198 const bool device_enabled_ = false;
199 199
200 DISALLOW_COPY_AND_ASSIGN(GPUTrace); 200 DISALLOW_COPY_AND_ASSIGN(GPUTrace);
201 }; 201 };
202 202
203 class ScopedGPUTrace { 203 class ScopedGPUTrace {
204 public: 204 public:
205 ScopedGPUTrace(GPUTracer* gpu_tracer, 205 ScopedGPUTrace(GPUTracer* gpu_tracer,
206 GpuTracerSource source, 206 GpuTracerSource source,
207 const std::string& category, 207 const std::string& category,
208 const std::string& name) 208 const std::string& name)
209 : gpu_tracer_(gpu_tracer), source_(source) { 209 : gpu_tracer_(gpu_tracer), source_(source) {
210 gpu_tracer_->Begin(category, name, source_); 210 gpu_tracer_->Begin(category, name, source_);
211 } 211 }
212 212
213 ~ScopedGPUTrace() { gpu_tracer_->End(source_); } 213 ~ScopedGPUTrace() { gpu_tracer_->End(source_); }
214 214
215 private: 215 private:
216 GPUTracer* gpu_tracer_; 216 GPUTracer* gpu_tracer_;
217 GpuTracerSource source_; 217 GpuTracerSource source_;
218 }; 218 };
219 219
220 } // namespace gles2 220 } // namespace gles2
221 } // namespace gpu 221 } // namespace gpu
222 222
223 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ 223 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gpu_service_test.cc ('k') | gpu/command_buffer/service/gpu_tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698