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

Side by Side Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 784513002: DevTools: speed up DevToolsUIBindings::DispatchProtocolMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« 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 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 "chrome/browser/devtools/devtools_ui_bindings.h" 5 #include "chrome/browser/devtools/devtools_ui_bindings.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (agent_host_.get()) 442 if (agent_host_.get())
443 agent_host_->DispatchProtocolMessage(message); 443 agent_host_->DispatchProtocolMessage(message);
444 } 444 }
445 445
446 // content::DevToolsAgentHostClient implementation -------------------------- 446 // content::DevToolsAgentHostClient implementation --------------------------
447 void DevToolsUIBindings::DispatchProtocolMessage( 447 void DevToolsUIBindings::DispatchProtocolMessage(
448 content::DevToolsAgentHost* agent_host, const std::string& message) { 448 content::DevToolsAgentHost* agent_host, const std::string& message) {
449 DCHECK(agent_host == agent_host_.get()); 449 DCHECK(agent_host == agent_host_.get());
450 450
451 if (message.length() < kMaxMessageChunkSize) { 451 if (message.length() < kMaxMessageChunkSize) {
452 base::StringValue message_value(message); 452 base::string16 javascript = base::UTF8ToUTF16(
453 CallClientFunction("DevToolsAPI.dispatchMessage", 453 "DevToolsAPI.dispatchMessage(" + message + ");");
yurys 2014/12/05 13:03:30 Content shell implementation should also be update
loislo 2014/12/05 13:11:26 Done.
454 &message_value, NULL, NULL); 454 web_contents_->GetMainFrame()->ExecuteJavaScript(javascript);
455 return; 455 return;
456 } 456 }
457 457
458 base::FundamentalValue total_size(static_cast<int>(message.length())); 458 base::FundamentalValue total_size(static_cast<int>(message.length()));
459 for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) { 459 for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) {
460 base::StringValue message_value(message.substr(pos, kMaxMessageChunkSize)); 460 base::StringValue message_value(message.substr(pos, kMaxMessageChunkSize));
461 CallClientFunction("DevToolsAPI.dispatchMessageChunk", 461 CallClientFunction("DevToolsAPI.dispatchMessageChunk",
462 &message_value, pos ? NULL : &total_size, NULL); 462 &message_value, pos ? NULL : &total_size, NULL);
463 } 463 }
464 } 464 }
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 if (frontend_loaded_) 901 if (frontend_loaded_)
902 return; 902 return;
903 frontend_loaded_ = true; 903 frontend_loaded_ = true;
904 904
905 // Call delegate first - it seeds importants bit of information. 905 // Call delegate first - it seeds importants bit of information.
906 delegate_->OnLoadCompleted(); 906 delegate_->OnLoadCompleted();
907 907
908 UpdateTheme(); 908 UpdateTheme();
909 AddDevToolsExtensionsToClient(); 909 AddDevToolsExtensionsToClient();
910 } 910 }
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