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

Unified Diff: src/debug/debug.cc

Issue 2685163006: [inspector] migrate set/remove BreakPoint to debug-interface.h (Closed)
Patch Set: added a test, ready for review Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index 84a16754e1d8c453dd5930addcefbb15a43df9c2..0b1d4f5e45c07753a1a1ad8a8b86bdabceb0b5e3 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -627,14 +627,29 @@ MaybeHandle<Object> Debug::CallFunction(const char* name, int argc,
// Check whether a single break point object is triggered.
bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
- Factory* factory = isolate_->factory();
- HandleScope scope(isolate_);
+ if (break_point_object->IsBreakPoint()) {
+ Handle<BreakPoint> break_point =
+ Handle<BreakPoint>::cast(break_point_object);
+ if (!break_point->condition()->IsString()) return true;
+ Handle<String> condition(String::cast(break_point->condition()));
+ Handle<Object> result;
+ if (!DebugEvaluate::Local(isolate_, break_frame_id(),
+ /* inlined_jsframe_index */ 0, condition, false)
Yang 2017/02/15 13:21:10 0 is wrong. If you have the situation where f call
kozy 2017/02/15 16:21:33 I thought that when we call CheckBreakpoint on top
Yang 2017/02/15 16:32:23 Ah yes you are right! Can you add a comment about
kozy 2017/02/15 16:42:33 Added.
+ .ToHandle(&result)) {
+ if (isolate_->has_pending_exception()) {
+ isolate_->clear_pending_exception();
+ }
+ return false;
+ }
+ return result->IsTrue(isolate_);
+ }
// Ignore check if break point object is not a JSObject.
Yang 2017/02/15 13:21:10 Can you add a TODO to remove the code below becaus
kozy 2017/02/15 16:21:33 Done.
if (!break_point_object->IsJSObject()) return true;
// Get the break id as an object.
- Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id());
+ Handle<Object> break_id =
+ isolate_->factory()->NewNumberFromInt(Debug::break_id());
// Call IsBreakPointTriggered.
Handle<Object> argv[] = { break_id, break_point_object };

Powered by Google App Engine
This is Rietveld 408576698