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

Side by Side Diff: content/common/gpu/client/command_buffer_metrics.cc

Issue 1936773002: Move attributes and context type out to ContextProviderCommandBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rmwgc3d
Patch Set: attributes: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/common/gpu/client/command_buffer_metrics.h" 5 #include "content/common/gpu/client/command_buffer_metrics.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 8
9 namespace content { 9 namespace content {
10 namespace command_buffer_metrics {
10 11
11 namespace { 12 namespace {
12 13
13 enum CommandBufferContextLostReason { 14 enum CommandBufferContextLostReason {
14 // Don't add new values here. 15 // Don't add new values here.
15 CONTEXT_INIT_FAILED, 16 CONTEXT_INIT_FAILED,
16 CONTEXT_LOST_GPU_CHANNEL_ERROR, 17 CONTEXT_LOST_GPU_CHANNEL_ERROR,
17 CONTEXT_PARSE_ERROR_INVALID_SIZE, 18 CONTEXT_PARSE_ERROR_INVALID_SIZE,
18 CONTEXT_PARSE_ERROR_OUT_OF_BOUNDS, 19 CONTEXT_PARSE_ERROR_OUT_OF_BOUNDS,
19 CONTEXT_PARSE_ERROR_UNKNOWN_COMMAND, 20 CONTEXT_PARSE_ERROR_UNKNOWN_COMMAND,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 case gpu::error::kDeferCommandUntilLater: 66 case gpu::error::kDeferCommandUntilLater:
66 case gpu::error::kNoError: 67 case gpu::error::kNoError:
67 case gpu::error::kLostContext: 68 case gpu::error::kLostContext:
68 NOTREACHED(); 69 NOTREACHED();
69 return CONTEXT_LOST_UNKNOWN; 70 return CONTEXT_LOST_UNKNOWN;
70 } 71 }
71 NOTREACHED(); 72 NOTREACHED();
72 return CONTEXT_LOST_UNKNOWN; 73 return CONTEXT_LOST_UNKNOWN;
73 } 74 }
74 75
75 void RecordContextLost(CommandBufferContextType type, 76 void RecordContextLost(ContextType type,
76 CommandBufferContextLostReason reason) { 77 CommandBufferContextLostReason reason) {
77 switch (type) { 78 switch (type) {
78 case DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT: 79 case DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT:
79 UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.BrowserCompositor", reason, 80 UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.BrowserCompositor", reason,
80 CONTEXT_LOST_REASON_MAX_ENUM); 81 CONTEXT_LOST_REASON_MAX_ENUM);
81 break; 82 break;
82 case BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT: 83 case BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT:
83 UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.BrowserMainThread", reason, 84 UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.BrowserMainThread", reason,
84 CONTEXT_LOST_REASON_MAX_ENUM); 85 CONTEXT_LOST_REASON_MAX_ENUM);
85 break; 86 break;
(...skipping 27 matching lines...) Expand all
113 break; 114 break;
114 case CONTEXT_TYPE_UNKNOWN: 115 case CONTEXT_TYPE_UNKNOWN:
115 UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.Unknown", reason, 116 UMA_HISTOGRAM_ENUMERATION("GPU.ContextLost.Unknown", reason,
116 CONTEXT_LOST_REASON_MAX_ENUM); 117 CONTEXT_LOST_REASON_MAX_ENUM);
117 break; 118 break;
118 } 119 }
119 } 120 }
120 121
121 } // anonymous namespace 122 } // anonymous namespace
122 123
123 std::string CommandBufferContextTypeToString(CommandBufferContextType type) { 124 std::string ContextTypeToString(ContextType type) {
124 switch (type) { 125 switch (type) {
125 case OFFSCREEN_CONTEXT_FOR_TESTING: 126 case OFFSCREEN_CONTEXT_FOR_TESTING:
126 return "Context-For-Testing"; 127 return "Context-For-Testing";
127 case DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT: 128 case DISPLAY_COMPOSITOR_ONSCREEN_CONTEXT:
128 return "DisplayCompositor"; 129 return "DisplayCompositor";
129 case BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT: 130 case BROWSER_OFFSCREEN_MAINTHREAD_CONTEXT:
130 return "Offscreen-MainThread"; 131 return "Offscreen-MainThread";
131 case BROWSER_WORKER_CONTEXT: 132 case BROWSER_WORKER_CONTEXT:
132 return "CompositorWorker"; 133 return "CompositorWorker";
133 case RENDER_COMPOSITOR_CONTEXT: 134 case RENDER_COMPOSITOR_CONTEXT:
134 return "RenderCompositor"; 135 return "RenderCompositor";
135 case RENDER_WORKER_CONTEXT: 136 case RENDER_WORKER_CONTEXT:
136 return "RenderWorker"; 137 return "RenderWorker";
137 case RENDERER_MAINTHREAD_CONTEXT: 138 case RENDERER_MAINTHREAD_CONTEXT:
138 return "Offscreen-MainThread"; 139 return "Offscreen-MainThread";
139 case GPU_VIDEO_ACCELERATOR_CONTEXT: 140 case GPU_VIDEO_ACCELERATOR_CONTEXT:
140 return "GPU-VideoAccelerator-Offscreen"; 141 return "GPU-VideoAccelerator-Offscreen";
141 case OFFSCREEN_VIDEO_CAPTURE_CONTEXT: 142 case OFFSCREEN_VIDEO_CAPTURE_CONTEXT:
142 return "Offscreen-CaptureThread"; 143 return "Offscreen-CaptureThread";
143 case OFFSCREEN_CONTEXT_FOR_WEBGL: 144 case OFFSCREEN_CONTEXT_FOR_WEBGL:
144 return "Offscreen-For-WebGL"; 145 return "Offscreen-For-WebGL";
145 default: 146 default:
146 NOTREACHED(); 147 NOTREACHED();
147 return "unknown"; 148 return "unknown";
148 } 149 }
149 } 150 }
150 151
151 void UmaRecordContextInitFailed(CommandBufferContextType type) { 152 void UmaRecordContextInitFailed(ContextType type) {
152 RecordContextLost(type, CONTEXT_INIT_FAILED); 153 RecordContextLost(type, CONTEXT_INIT_FAILED);
153 } 154 }
154 155
155 void UmaRecordContextLost(CommandBufferContextType type, 156 void UmaRecordContextLost(ContextType type,
156 gpu::error::Error error, 157 gpu::error::Error error,
157 gpu::error::ContextLostReason reason) { 158 gpu::error::ContextLostReason reason) {
158 CommandBufferContextLostReason converted_reason = 159 CommandBufferContextLostReason converted_reason =
159 GetContextLostReason(error, reason); 160 GetContextLostReason(error, reason);
160 RecordContextLost(type, converted_reason); 161 RecordContextLost(type, converted_reason);
161 } 162 }
162 163
164 } // namespace command_buffer_metrics
163 } // namespace content 165 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_metrics.h ('k') | content/common/gpu/client/context_provider_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698