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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.cpp

Issue 2452403002: [Bindings] Reformat template files (4/4) (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | « third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.h ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 // clang-format off 7 // clang-format off
8 8
9 #include "VoidCallbackFunctionModules.h" 9 #include "VoidCallbackFunctionModules.h"
10 10
11 #include "bindings/core/v8/ExceptionState.h" 11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/ScriptState.h" 12 #include "bindings/core/v8/ScriptState.h"
13 #include "bindings/core/v8/ToV8.h" 13 #include "bindings/core/v8/ToV8.h"
14 #include "bindings/core/v8/V8Binding.h" 14 #include "bindings/core/v8/V8Binding.h"
15 #include "core/dom/ExecutionContext.h" 15 #include "core/dom/ExecutionContext.h"
16 #include "wtf/Assertions.h" 16 #include "wtf/Assertions.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 VoidCallbackFunctionModules::VoidCallbackFunctionModules(ScriptState* scriptStat e, v8::Local<v8::Function> callback) 20 VoidCallbackFunctionModules::VoidCallbackFunctionModules(ScriptState* scriptStat e, v8::Local<v8::Function> callback)
21 : m_scriptState(scriptState), 21 : m_scriptState(scriptState),
22 m_callback(scriptState->isolate(), callback) 22 m_callback(scriptState->isolate(), callback) {
23 { 23 DCHECK(!m_callback.isEmpty());
24 DCHECK(!m_callback.isEmpty()); 24 m_callback.setPhantom();
25 m_callback.setPhantom();
26 } 25 }
27 26
28 DEFINE_TRACE(VoidCallbackFunctionModules) 27 DEFINE_TRACE(VoidCallbackFunctionModules) {}
29 { 28
29 DEFINE_TRACE_WRAPPERS(VoidCallbackFunctionModules) {
30 visitor->traceWrappers(&m_callback.cast<v8::Object>());
30 } 31 }
31 32
32 DEFINE_TRACE_WRAPPERS(VoidCallbackFunctionModules) 33 bool VoidCallbackFunctionModules::call(ScriptWrappable* scriptWrappable) {
33 { 34 if (!m_scriptState->contextIsValid())
34 visitor->traceWrappers(&m_callback.cast<v8::Object>()); 35 return false;
36
37 ExecutionContext* context = m_scriptState->getExecutionContext();
38 DCHECK(context);
39 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreSto pped())
40 return false;
41
42 if (m_callback.isEmpty())
43 return false;
44
45 // TODO(bashi): Make sure that using TrackExceptionState is OK.
46 // crbug.com/653769
47 TrackExceptionState exceptionState;
48 ScriptState::Scope scope(m_scriptState.get());
49
50 v8::Local<v8::Value> thisValue = toV8(scriptWrappable, m_scriptState->context( )->Global(), m_scriptState->isolate());
51
52 v8::Local<v8::Value> *argv = nullptr;
53
54 v8::Local<v8::Value> v8ReturnValue;
55 v8::TryCatch exceptionCatcher(m_scriptState->isolate());
56 exceptionCatcher.SetVerbose(true);
57
58 if (V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()) , m_scriptState->getExecutionContext(), thisValue, 0, argv, m_scriptState->isola te()).ToLocal(&v8ReturnValue)) {
59 return true;
60 }
61 return false;
35 } 62 }
36 63
37 bool VoidCallbackFunctionModules::call(ScriptWrappable* scriptWrappable) 64 } // namespace blink
38 {
39 if (!m_scriptState->contextIsValid())
40 return false;
41
42 ExecutionContext* context = m_scriptState->getExecutionContext();
43 DCHECK(context);
44 if (context->activeDOMObjectsAreSuspended() || context->activeDOMObjectsAreS topped())
45 return false;
46
47 if (m_callback.isEmpty())
48 return false;
49
50 // TODO(bashi): Make sure that using TrackExceptionState is OK.
51 // crbug.com/653769
52 TrackExceptionState exceptionState;
53 ScriptState::Scope scope(m_scriptState.get());
54
55 v8::Local<v8::Value> thisValue = toV8(scriptWrappable, m_scriptState->contex t()->Global(), m_scriptState->isolate());
56
57 v8::Local<v8::Value> *argv = nullptr;
58
59 v8::Local<v8::Value> v8ReturnValue;
60 v8::TryCatch exceptionCatcher(m_scriptState->isolate());
61 exceptionCatcher.SetVerbose(true);
62
63 if (V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate( )), m_scriptState->getExecutionContext(), thisValue, 0, argv, m_scriptState->iso late()).ToLocal(&v8ReturnValue))
64 {
65 return true;
66 }
67 return false;
68 }
69
70 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/modules/VoidCallbackFunctionModules.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698