OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "src/inspector/v8-function-call.h" | 31 #include "src/inspector/v8-function-call.h" |
32 | 32 |
| 33 #include "src/inspector/inspected-context.h" |
33 #include "src/inspector/string-util.h" | 34 #include "src/inspector/string-util.h" |
34 #include "src/inspector/v8-debugger.h" | 35 #include "src/inspector/v8-debugger.h" |
35 #include "src/inspector/v8-inspector-impl.h" | 36 #include "src/inspector/v8-inspector-impl.h" |
36 | 37 |
37 #include "include/v8-inspector.h" | 38 #include "include/v8-inspector.h" |
38 | 39 |
39 namespace v8_inspector { | 40 namespace v8_inspector { |
40 | 41 |
41 V8FunctionCall::V8FunctionCall(V8InspectorImpl* inspector, | 42 V8FunctionCall::V8FunctionCall(V8InspectorImpl* inspector, |
42 v8::Local<v8::Context> context, | 43 v8::Local<v8::Context> context, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 DCHECK(value->IsFunction()); | 83 DCHECK(value->IsFunction()); |
83 | 84 |
84 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); | 85 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); |
85 std::unique_ptr<v8::Local<v8::Value>[]> info( | 86 std::unique_ptr<v8::Local<v8::Value>[]> info( |
86 new v8::Local<v8::Value>[m_arguments.size()]); | 87 new v8::Local<v8::Value>[m_arguments.size()]); |
87 for (size_t i = 0; i < m_arguments.size(); ++i) { | 88 for (size_t i = 0; i < m_arguments.size(); ++i) { |
88 info[i] = m_arguments[i]; | 89 info[i] = m_arguments[i]; |
89 DCHECK(!info[i].IsEmpty()); | 90 DCHECK(!info[i].IsEmpty()); |
90 } | 91 } |
91 | 92 |
92 int contextGroupId = V8Debugger::getGroupId(m_context); | 93 int contextGroupId = m_inspector->contextGroupId(m_context); |
93 if (contextGroupId) { | 94 if (contextGroupId) { |
94 m_inspector->client()->muteMetrics(contextGroupId); | 95 m_inspector->client()->muteMetrics(contextGroupId); |
95 m_inspector->muteExceptions(contextGroupId); | 96 m_inspector->muteExceptions(contextGroupId); |
96 } | 97 } |
97 v8::MicrotasksScope microtasksScope(m_context->GetIsolate(), | 98 v8::MicrotasksScope microtasksScope(m_context->GetIsolate(), |
98 v8::MicrotasksScope::kDoNotRunMicrotasks); | 99 v8::MicrotasksScope::kDoNotRunMicrotasks); |
99 v8::MaybeLocal<v8::Value> maybeResult = function->Call( | 100 v8::MaybeLocal<v8::Value> maybeResult = function->Call( |
100 m_context, thisObject, static_cast<int>(m_arguments.size()), info.get()); | 101 m_context, thisObject, static_cast<int>(m_arguments.size()), info.get()); |
101 if (contextGroupId) { | 102 if (contextGroupId) { |
102 m_inspector->client()->unmuteMetrics(contextGroupId); | 103 m_inspector->client()->unmuteMetrics(contextGroupId); |
103 m_inspector->unmuteExceptions(contextGroupId); | 104 m_inspector->unmuteExceptions(contextGroupId); |
104 } | 105 } |
105 | 106 |
106 v8::Local<v8::Value> result; | 107 v8::Local<v8::Value> result; |
107 if (!maybeResult.ToLocal(&result)) return v8::Local<v8::Value>(); | 108 if (!maybeResult.ToLocal(&result)) return v8::Local<v8::Value>(); |
108 return result; | 109 return result; |
109 } | 110 } |
110 | 111 |
111 } // namespace v8_inspector | 112 } // namespace v8_inspector |
OLD | NEW |