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

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

Issue 434113002: Split trace messages into chunks based on size, not event count (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « no previous file | 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 <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 DCHECK(ok); 85 DCHECK(ok);
86 std::string buffer; 86 std::string buffer;
87 for (size_t i = 0; i < list->GetSize(); ++i) { 87 for (size_t i = 0; i < list->GetSize(); ++i) {
88 std::string item; 88 std::string item;
89 base::Value* item_value; 89 base::Value* item_value;
90 list->Get(i, &item_value); 90 list->Get(i, &item_value);
91 base::JSONWriter::Write(item_value, &item); 91 base::JSONWriter::Write(item_value, &item);
92 if (buffer.size()) 92 if (buffer.size())
93 buffer.append(","); 93 buffer.append(",");
94 buffer.append(item); 94 buffer.append(item);
95 if (i % 1000 == 0) { 95 const size_t kMessageSizeThreshold = 1024 * 1024;
96 if (buffer.size() > kMessageSizeThreshold) {
96 OnTraceDataCollected(buffer); 97 OnTraceDataCollected(buffer);
97 buffer.clear(); 98 buffer.clear();
98 } 99 }
99 } 100 }
100 if (buffer.size()) 101 if (buffer.size())
101 OnTraceDataCollected(buffer); 102 OnTraceDataCollected(buffer);
102 } 103 }
103 104
104 SendNotification(devtools::Tracing::tracingComplete::kName, NULL); 105 SendNotification(devtools::Tracing::tracingComplete::kName, NULL);
105 } 106 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 it != category_set.end(); ++it) { 243 it != category_set.end(); ++it) {
243 category_list->AppendString(*it); 244 category_list->AppendString(*it);
244 } 245 }
245 246
246 response->Set(devtools::Tracing::getCategories::kResponseCategories, 247 response->Set(devtools::Tracing::getCategories::kResponseCategories,
247 category_list); 248 category_list);
248 SendAsyncResponse(command->SuccessResponse(response)); 249 SendAsyncResponse(command->SuccessResponse(response));
249 } 250 }
250 251
251 } // namespace content 252 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698