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

Side by Side Diff: src/api.cc

Issue 2622253004: [inspector] introduced debug::SetBreakEventListener,SetExceptionEventListener (Closed)
Patch Set: addressed comments Created 3 years, 11 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
« no previous file with comments | « no previous file | src/debug/debug.h » ('j') | src/debug/debug.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 8969 matching lines...) Expand 10 before | Expand all | Expand 10 after
8980 Local<Value> value) { 8980 Local<Value> value) {
8981 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 8981 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
8982 ENTER_V8(isolate); 8982 ENTER_V8(isolate);
8983 i::Handle<i::Object> val = Utils::OpenHandle(*value); 8983 i::Handle<i::Object> val = Utils::OpenHandle(*value);
8984 i::Handle<i::JSArray> result; 8984 i::Handle<i::JSArray> result;
8985 if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result)) 8985 if (!i::Runtime::GetInternalProperties(isolate, val).ToHandle(&result))
8986 return MaybeLocal<Array>(); 8986 return MaybeLocal<Array>();
8987 return Utils::ToLocal(result); 8987 return Utils::ToLocal(result);
8988 } 8988 }
8989 8989
8990 bool debug::SetDebugEventListener(Isolate* isolate, debug::EventCallback that,
8991 Local<Value> data) {
8992 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
8993 ENTER_V8(i_isolate);
8994 i::HandleScope scope(i_isolate);
8995 i::Handle<i::Object> foreign = i_isolate->factory()->undefined_value();
8996 if (that != NULL) {
8997 foreign = i_isolate->factory()->NewForeign(FUNCTION_ADDR(that));
8998 }
8999 i_isolate->debug()->SetEventListener(foreign, Utils::OpenHandle(*data, true));
9000 return true;
9001 }
9002
9003 Local<Context> debug::GetDebugContext(Isolate* isolate) { 8990 Local<Context> debug::GetDebugContext(Isolate* isolate) {
9004 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 8991 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
9005 ENTER_V8(i_isolate); 8992 ENTER_V8(i_isolate);
9006 return Utils::ToLocal(i_isolate->debug()->GetDebugContext()); 8993 return Utils::ToLocal(i_isolate->debug()->GetDebugContext());
9007 } 8994 }
9008 8995
9009 MaybeLocal<Value> debug::Call(Local<Context> context, 8996 MaybeLocal<Value> debug::Call(Local<Context> context,
9010 v8::Local<v8::Function> fun, 8997 v8::Local<v8::Function> fun,
9011 v8::Local<v8::Value> data) { 8998 v8::Local<v8::Value> data) {
9012 return Debug::Call(context, fun, data); 8999 return Debug::Call(context, fun, data);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
9324 result = i::Compiler::GetSharedFunctionInfoForScript( 9311 result = i::Compiler::GetSharedFunctionInfoForScript(
9325 str, i::Handle<i::Object>(), 0, 0, origin_options, 9312 str, i::Handle<i::Object>(), 0, 0, origin_options,
9326 i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data, 9313 i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data,
9327 ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE, false); 9314 ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE, false);
9328 has_pending_exception = result.is_null(); 9315 has_pending_exception = result.is_null();
9329 RETURN_ON_FAILED_EXECUTION(UnboundScript); 9316 RETURN_ON_FAILED_EXECUTION(UnboundScript);
9330 } 9317 }
9331 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result)); 9318 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result));
9332 } 9319 }
9333 9320
9334 void debug::SetAsyncTaskListener(Isolate* v8_isolate, 9321 void debug::SetDebugEventListener(Isolate* v8_isolate,
9335 debug::AsyncTaskListener listener, 9322 debug::DebugEventListener* listener) {
9336 void* data) {
9337 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 9323 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
9338 ENTER_V8(isolate); 9324 ENTER_V8(isolate);
9339 isolate->debug()->SetAsyncTaskListener(listener, data); 9325 isolate->debug()->SetDebugEventListener(listener);
9340 }
9341
9342 void debug::SetCompileEventListener(Isolate* v8_isolate,
9343 debug::CompileEventListener listener,
9344 void* data) {
9345 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
9346 ENTER_V8(isolate);
9347 isolate->debug()->SetCompileEventListener(listener, data);
9348 } 9326 }
9349 9327
9350 Local<String> CpuProfileNode::GetFunctionName() const { 9328 Local<String> CpuProfileNode::GetFunctionName() const {
9351 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 9329 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
9352 i::Isolate* isolate = node->isolate(); 9330 i::Isolate* isolate = node->isolate();
9353 const i::CodeEntry* entry = node->entry(); 9331 const i::CodeEntry* entry = node->entry();
9354 i::Handle<i::String> name = 9332 i::Handle<i::String> name =
9355 isolate->factory()->InternalizeUtf8String(entry->name()); 9333 isolate->factory()->InternalizeUtf8String(entry->name());
9356 if (!entry->has_name_prefix()) { 9334 if (!entry->has_name_prefix()) {
9357 return ToApiHandle<String>(name); 9335 return ToApiHandle<String>(name);
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
10027 Address callback_address = 10005 Address callback_address =
10028 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10006 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10029 VMState<EXTERNAL> state(isolate); 10007 VMState<EXTERNAL> state(isolate);
10030 ExternalCallbackScope call_scope(isolate, callback_address); 10008 ExternalCallbackScope call_scope(isolate, callback_address);
10031 callback(info); 10009 callback(info);
10032 } 10010 }
10033 10011
10034 10012
10035 } // namespace internal 10013 } // namespace internal
10036 } // namespace v8 10014 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/debug/debug.h » ('j') | src/debug/debug.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698