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

Side by Side Diff: webkit/glue/devtools/debugger_agent_impl.cc

Issue 460018: DevTools: make possible profiling of scripts doing heavy calculations. (Closed)
Patch Set: Comments addressed Created 11 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 | « webkit/glue/devtools/debugger_agent_impl.h ('k') | webkit/glue/devtools/js/debugger_agent.js » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "config.h" 5 #include "config.h"
6 6
7 #include <wtf/HashSet.h> 7 #include <wtf/HashSet.h>
8 #include <wtf/RefPtr.h> 8 #include <wtf/RefPtr.h>
9 #include <wtf/Vector.h> 9 #include <wtf/Vector.h>
10 10
(...skipping 26 matching lines...) Expand all
37 using WebCore::V8Proxy; 37 using WebCore::V8Proxy;
38 using WebKit::WebViewImpl; 38 using WebKit::WebViewImpl;
39 39
40 DebuggerAgentImpl::DebuggerAgentImpl( 40 DebuggerAgentImpl::DebuggerAgentImpl(
41 WebViewImpl* web_view_impl, 41 WebViewImpl* web_view_impl,
42 DebuggerAgentDelegate* delegate, 42 DebuggerAgentDelegate* delegate,
43 WebDevToolsAgentImpl* webdevtools_agent) 43 WebDevToolsAgentImpl* webdevtools_agent)
44 : web_view_impl_(web_view_impl), 44 : web_view_impl_(web_view_impl),
45 delegate_(delegate), 45 delegate_(delegate),
46 webdevtools_agent_(webdevtools_agent), 46 webdevtools_agent_(webdevtools_agent),
47 profiler_log_position_(0),
48 auto_continue_on_exception_(false) { 47 auto_continue_on_exception_(false) {
49 DebuggerAgentManager::DebugAttach(this); 48 DebuggerAgentManager::DebugAttach(this);
50 } 49 }
51 50
52 DebuggerAgentImpl::~DebuggerAgentImpl() { 51 DebuggerAgentImpl::~DebuggerAgentImpl() {
53 DebuggerAgentManager::DebugDetach(this); 52 DebuggerAgentManager::DebugDetach(this);
54 } 53 }
55 54
56 void DebuggerAgentImpl::GetContextId() { 55 void DebuggerAgentImpl::GetContextId() {
57 delegate_->SetContextId(webdevtools_agent_->host_id()); 56 delegate_->SetContextId(webdevtools_agent_->host_id());
58 } 57 }
59 58
60 void DebuggerAgentImpl::StartProfiling(int flags) {
61 v8::HandleScope scope;
62 WebCore::Frame* frame = GetPage()->mainFrame();
63 ASSERT(V8Proxy::retrieve(GetPage()->mainFrame())->isContextInitialized());
64 v8::Context::Scope context_scope(V8Proxy::context(frame));
65 v8::V8::ResumeProfilerEx(flags);
66 }
67
68 void DebuggerAgentImpl::StopProfiling(int flags) {
69 v8::V8::PauseProfilerEx(flags);
70 }
71
72 void DebuggerAgentImpl::GetActiveProfilerModules() {
73 delegate_->DidGetActiveProfilerModules(v8::V8::GetActiveProfilerModules());
74 }
75
76 void DebuggerAgentImpl::GetNextLogLines() {
77 static char buffer[65536];
78 int read_size = v8::V8::GetLogLines(
79 profiler_log_position_, buffer, sizeof(buffer) - 1);
80 profiler_log_position_ += read_size;
81 buffer[read_size] = '\0';
82 delegate_->DidGetNextLogLines(buffer);
83 }
84
85 void DebuggerAgentImpl::DebuggerOutput(const String& command) { 59 void DebuggerAgentImpl::DebuggerOutput(const String& command) {
86 delegate_->DebuggerOutput(command); 60 delegate_->DebuggerOutput(command);
87 webdevtools_agent_->ForceRepaint(); 61 webdevtools_agent_->ForceRepaint();
88 } 62 }
89 63
90 // static 64 // static
91 void DebuggerAgentImpl::CreateUtilityContext( 65 void DebuggerAgentImpl::CreateUtilityContext(
92 Frame* frame, 66 Frame* frame,
93 v8::Persistent<v8::Context>* context) { 67 v8::Persistent<v8::Context>* context) {
94 v8::HandleScope scope; 68 v8::HandleScope scope;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 ASSERT(function->IsFunction()); 174 ASSERT(function->IsFunction());
201 v8::Handle<v8::Value> args[] = { 175 v8::Handle<v8::Value> args[] = {
202 v8::Local<v8::Value>() 176 v8::Local<v8::Value>()
203 }; 177 };
204 v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, args); 178 v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, args);
205 } 179 }
206 180
207 WebCore::Page* DebuggerAgentImpl::GetPage() { 181 WebCore::Page* DebuggerAgentImpl::GetPage() {
208 return web_view_impl_->page(); 182 return web_view_impl_->page();
209 } 183 }
OLDNEW
« no previous file with comments | « webkit/glue/devtools/debugger_agent_impl.h ('k') | webkit/glue/devtools/js/debugger_agent.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698