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

Side by Side Diff: content/browser/devtools/protocol/tracing_handler.cc

Issue 717083003: Report trace buffer usage as number of events, not only percentage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/devtools/protocol/tracing_handler.h" 5 #include "content/browser/devtools/protocol/tracing_handler.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/trace_event_impl.h" 10 #include "base/debug/trace_event_impl.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 weak_factory_.GetWeakPtr(), 135 weak_factory_.GetWeakPtr(),
136 command)); 136 command));
137 return command->AsyncResponsePromise(); 137 return command->AsyncResponsePromise();
138 } 138 }
139 139
140 void TracingHandler::OnRecordingEnabled( 140 void TracingHandler::OnRecordingEnabled(
141 scoped_refptr<DevToolsProtocol::Command> command) { 141 scoped_refptr<DevToolsProtocol::Command> command) {
142 client_->SendStartResponse(command, StartResponse::Create()); 142 client_->SendStartResponse(command, StartResponse::Create());
143 } 143 }
144 144
145 void TracingHandler::OnBufferUsage(float usage) { 145 void TracingHandler::OnBufferUsage(float percent_full,
146 client_->BufferUsage(BufferUsageParams::Create()->set_value(usage)); 146 size_t approximate_event_count) {
147 client_->BufferUsage(BufferUsageParams::Create()->set_value(percent_full));
147 } 148 }
148 149
149 void TracingHandler::OnCategoriesReceived( 150 void TracingHandler::OnCategoriesReceived(
150 scoped_refptr<DevToolsProtocol::Command> command, 151 scoped_refptr<DevToolsProtocol::Command> command,
151 const std::set<std::string>& category_set) { 152 const std::set<std::string>& category_set) {
152 std::vector<std::string> categories; 153 std::vector<std::string> categories;
153 for (const std::string& category : category_set) 154 for (const std::string& category : category_set)
154 categories.push_back(category); 155 categories.push_back(category);
155 client_->SendGetCategoriesResponse(command, 156 client_->SendGetCategoriesResponse(command,
156 GetCategoriesResponse::Create()->set_categories(categories)); 157 GetCategoriesResponse::Create()->set_categories(categories));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 void TracingHandler::DisableRecording(bool abort) { 204 void TracingHandler::DisableRecording(bool abort) {
204 is_recording_ = false; 205 is_recording_ = false;
205 buffer_usage_poll_timer_.reset(); 206 buffer_usage_poll_timer_.reset();
206 TracingController::GetInstance()->DisableRecording( 207 TracingController::GetInstance()->DisableRecording(
207 abort ? nullptr : new DevToolsTraceSinkProxy(weak_factory_.GetWeakPtr())); 208 abort ? nullptr : new DevToolsTraceSinkProxy(weak_factory_.GetWeakPtr()));
208 } 209 }
209 210
210 } // namespace tracing 211 } // namespace tracing
211 } // namespace devtools 212 } // namespace devtools
212 } // namespace content 213 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698