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

Side by Side Diff: src/inspector/v8-regex.cc

Issue 2841053002: [inspector] Add some context scopes to inspector code (Closed)
Patch Set: Drop unnecessary scope Created 3 years, 8 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 | « src/inspector/v8-function-call.cc ('k') | 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/inspector/v8-regex.h" 5 #include "src/inspector/v8-regex.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include "src/inspector/string-util.h" 9 #include "src/inspector/string-util.h"
10 #include "src/inspector/v8-inspector-impl.h" 10 #include "src/inspector/v8-inspector-impl.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if (matchLength) *matchLength = 0; 42 if (matchLength) *matchLength = 0;
43 43
44 if (m_regex.IsEmpty() || string.isEmpty()) return -1; 44 if (m_regex.IsEmpty() || string.isEmpty()) return -1;
45 45
46 // v8 strings are limited to int. 46 // v8 strings are limited to int.
47 if (string.length() > INT_MAX) return -1; 47 if (string.length() > INT_MAX) return -1;
48 48
49 v8::Isolate* isolate = m_inspector->isolate(); 49 v8::Isolate* isolate = m_inspector->isolate();
50 v8::HandleScope handleScope(isolate); 50 v8::HandleScope handleScope(isolate);
51 v8::Local<v8::Context> context = m_inspector->regexContext(); 51 v8::Local<v8::Context> context = m_inspector->regexContext();
52 v8::Context::Scope contextScope(context);
52 v8::MicrotasksScope microtasks(isolate, 53 v8::MicrotasksScope microtasks(isolate,
53 v8::MicrotasksScope::kDoNotRunMicrotasks); 54 v8::MicrotasksScope::kDoNotRunMicrotasks);
54 v8::TryCatch tryCatch(isolate); 55 v8::TryCatch tryCatch(isolate);
55 56
56 v8::Local<v8::RegExp> regex = m_regex.Get(isolate); 57 v8::Local<v8::RegExp> regex = m_regex.Get(isolate);
57 v8::Local<v8::Value> exec; 58 v8::Local<v8::Value> exec;
58 if (!regex->Get(context, toV8StringInternalized(isolate, "exec")) 59 if (!regex->Get(context, toV8StringInternalized(isolate, "exec"))
59 .ToLocal(&exec)) 60 .ToLocal(&exec))
60 return -1; 61 return -1;
61 v8::Local<v8::Value> argv[] = { 62 v8::Local<v8::Value> argv[] = {
(...skipping 22 matching lines...) Expand all
84 if (matchLength) { 85 if (matchLength) {
85 v8::Local<v8::Value> match; 86 v8::Local<v8::Value> match;
86 if (!result->Get(context, 0).ToLocal(&match)) return -1; 87 if (!result->Get(context, 0).ToLocal(&match)) return -1;
87 *matchLength = match.As<v8::String>()->Length(); 88 *matchLength = match.As<v8::String>()->Length();
88 } 89 }
89 90
90 return matchOffset.As<v8::Int32>()->Value() + startFrom; 91 return matchOffset.As<v8::Int32>()->Value() + startFrom;
91 } 92 }
92 93
93 } // namespace v8_inspector 94 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-function-call.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698