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

Side by Side Diff: content/browser/devtools/devtools_tracing_handler.cc

Issue 17176024: Add option to enable sampler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/browser/devtools/devtools_tracing_handler.h" 5 #include "content/browser/devtools/devtools_tracing_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 10 matching lines...) Expand all
21 const char kTracingEndCommand[] = "Tracing.end"; 21 const char kTracingEndCommand[] = "Tracing.end";
22 22
23 const char kTracingCompleteNotification[] = "Tracing.tracingComplete"; 23 const char kTracingCompleteNotification[] = "Tracing.tracingComplete";
24 const char kTracingDataCollected[] = "Tracing.dataCollected"; 24 const char kTracingDataCollected[] = "Tracing.dataCollected";
25 25
26 const char kCategoriesParam[] = "categories"; 26 const char kCategoriesParam[] = "categories";
27 27
28 const char kTraceOptionsParam[] = "trace-options"; 28 const char kTraceOptionsParam[] = "trace-options";
29 const char kRecordUntilFull[] = "record-until-full"; 29 const char kRecordUntilFull[] = "record-until-full";
30 const char kRecordContinuously[] = "record-continuously"; 30 const char kRecordContinuously[] = "record-continuously";
31 const char kEnableSampling[] = "enable-sampling";
31 32
32 } // namespace 33 } // namespace
33 34
34 const char DevToolsTracingHandler::kDomain[] = "Tracing"; 35 const char DevToolsTracingHandler::kDomain[] = "Tracing";
35 36
36 DevToolsTracingHandler::DevToolsTracingHandler() 37 DevToolsTracingHandler::DevToolsTracingHandler()
37 : is_running_(false) { 38 : is_running_(false) {
38 RegisterCommandHandler(kTracingStartCommand, 39 RegisterCommandHandler(kTracingStartCommand,
39 base::Bind(&DevToolsTracingHandler::OnStart, 40 base::Bind(&DevToolsTracingHandler::OnStart,
40 base::Unretained(this))); 41 base::Unretained(this)));
(...skipping 26 matching lines...) Expand all
67 std::vector<std::string> split; 68 std::vector<std::string> split;
68 std::vector<std::string>::iterator iter; 69 std::vector<std::string>::iterator iter;
69 int ret = 0; 70 int ret = 0;
70 71
71 base::SplitString(options, ',', &split); 72 base::SplitString(options, ',', &split);
72 for (iter = split.begin(); iter != split.end(); ++iter) { 73 for (iter = split.begin(); iter != split.end(); ++iter) {
73 if (*iter == kRecordUntilFull) { 74 if (*iter == kRecordUntilFull) {
74 ret |= base::debug::TraceLog::RECORD_UNTIL_FULL; 75 ret |= base::debug::TraceLog::RECORD_UNTIL_FULL;
75 } else if (*iter == kRecordContinuously) { 76 } else if (*iter == kRecordContinuously) {
76 ret |= base::debug::TraceLog::RECORD_CONTINUOUSLY; 77 ret |= base::debug::TraceLog::RECORD_CONTINUOUSLY;
78 } else if (*iter == kEnableSampling) {
79 ret |= base::debug::TraceLog::ENABLE_SAMPLING;
77 } 80 }
78 } 81 }
79 if (!(ret & base::debug::TraceLog::RECORD_UNTIL_FULL) && 82 if (!(ret & base::debug::TraceLog::RECORD_UNTIL_FULL) &&
80 !(ret & base::debug::TraceLog::RECORD_CONTINUOUSLY)) 83 !(ret & base::debug::TraceLog::RECORD_CONTINUOUSLY))
81 ret |= base::debug::TraceLog::RECORD_UNTIL_FULL; 84 ret |= base::debug::TraceLog::RECORD_UNTIL_FULL;
82 85
83 return static_cast<base::debug::TraceLog::Options>(ret); 86 return static_cast<base::debug::TraceLog::Options>(ret);
84 } 87 }
85 88
86 scoped_ptr<DevToolsProtocol::Response> 89 scoped_ptr<DevToolsProtocol::Response>
(...skipping 16 matching lines...) Expand all
103 return command->SuccessResponse(NULL); 106 return command->SuccessResponse(NULL);
104 } 107 }
105 108
106 scoped_ptr<DevToolsProtocol::Response> 109 scoped_ptr<DevToolsProtocol::Response>
107 DevToolsTracingHandler::OnEnd(DevToolsProtocol::Command* command) { 110 DevToolsTracingHandler::OnEnd(DevToolsProtocol::Command* command) {
108 TraceController::GetInstance()->EndTracingAsync(this); 111 TraceController::GetInstance()->EndTracingAsync(this);
109 return command->SuccessResponse(NULL); 112 return command->SuccessResponse(NULL);
110 } 113 }
111 114
112 } // namespace content 115 } // namespace content
OLDNEW
« no previous file with comments | « base/debug/trace_event_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698