| OLD | NEW |
| 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 Loading... |
| 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), |
| 47 auto_continue_on_exception_(false) { | 48 auto_continue_on_exception_(false) { |
| 48 DebuggerAgentManager::DebugAttach(this); | 49 DebuggerAgentManager::DebugAttach(this); |
| 49 } | 50 } |
| 50 | 51 |
| 51 DebuggerAgentImpl::~DebuggerAgentImpl() { | 52 DebuggerAgentImpl::~DebuggerAgentImpl() { |
| 52 DebuggerAgentManager::DebugDetach(this); | 53 DebuggerAgentManager::DebugDetach(this); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void DebuggerAgentImpl::GetContextId() { | 56 void DebuggerAgentImpl::GetContextId() { |
| 56 delegate_->SetContextId(webdevtools_agent_->host_id()); | 57 delegate_->SetContextId(webdevtools_agent_->host_id()); |
| 57 } | 58 } |
| 58 | 59 |
| 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 |
| 59 void DebuggerAgentImpl::DebuggerOutput(const String& command) { | 85 void DebuggerAgentImpl::DebuggerOutput(const String& command) { |
| 60 delegate_->DebuggerOutput(command); | 86 delegate_->DebuggerOutput(command); |
| 61 webdevtools_agent_->ForceRepaint(); | 87 webdevtools_agent_->ForceRepaint(); |
| 62 } | 88 } |
| 63 | 89 |
| 64 // static | 90 // static |
| 65 void DebuggerAgentImpl::CreateUtilityContext( | 91 void DebuggerAgentImpl::CreateUtilityContext( |
| 66 Frame* frame, | 92 Frame* frame, |
| 67 v8::Persistent<v8::Context>* context) { | 93 v8::Persistent<v8::Context>* context) { |
| 68 v8::HandleScope scope; | 94 v8::HandleScope scope; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 ASSERT(function->IsFunction()); | 200 ASSERT(function->IsFunction()); |
| 175 v8::Handle<v8::Value> args[] = { | 201 v8::Handle<v8::Value> args[] = { |
| 176 v8::Local<v8::Value>() | 202 v8::Local<v8::Value>() |
| 177 }; | 203 }; |
| 178 v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, args); | 204 v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, args); |
| 179 } | 205 } |
| 180 | 206 |
| 181 WebCore::Page* DebuggerAgentImpl::GetPage() { | 207 WebCore::Page* DebuggerAgentImpl::GetPage() { |
| 182 return web_view_impl_->page(); | 208 return web_view_impl_->page(); |
| 183 } | 209 } |
| OLD | NEW |