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

Side by Side Diff: sky/engine/bindings/core/v8/V8BindingMacros.h

Issue 922053002: Remove unused V8 integration code in Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « sky/engine/bindings/core/v8/V8Binding.cpp ('k') | sky/engine/bindings/core/v8/V8CacheOptions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29 */
30
31 #ifndef SKY_ENGINE_BINDINGS_CORE_V8_V8BINDINGMACROS_H_
32 #define SKY_ENGINE_BINDINGS_CORE_V8_V8BINDINGMACROS_H_
33
34 namespace blink {
35
36 // Naming scheme:
37 // TO*_RETURNTYPE[_ARGTYPE]...
38 // ...using _DEFAULT instead of _ANY..._ANY when returing a default value.
39
40 #define TONATIVE_EXCEPTION(type, var, value) \
41 type var; \
42 { \
43 v8::TryCatch block; \
44 var = (value); \
45 if (UNLIKELY(block.HasCaught())) \
46 return block.ReThrow(); \
47 }
48
49 #define TONATIVE_VOID_INTERNAL(var, value) \
50 var = (value); \
51 if (UNLIKELY(block.HasCaught())) \
52 return;
53
54 #define TONATIVE_VOID(type, var, value) \
55 type var; \
56 { \
57 v8::TryCatch block; \
58 V8RethrowTryCatchScope rethrow(block); \
59 TONATIVE_VOID_INTERNAL(var, value); \
60 }
61
62 #define TONATIVE_DEFAULT(type, var, value, retVal) \
63 type var; \
64 { \
65 v8::TryCatch block; \
66 var = (value); \
67 if (UNLIKELY(block.HasCaught())) { \
68 block.ReThrow(); \
69 return retVal; \
70 } \
71 }
72
73 // We need to cancel the exception propergation when we return a rejected
74 // Promise.
75 #define TONATIVE_VOID_PROMISE_INTERNAL(var, value, info) \
76 var = (value); \
77 if (UNLIKELY(block.HasCaught())) { \
78 v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), block .Exception())); \
79 block.Reset(); \
80 return; \
81 }
82
83 #define TONATIVE_VOID_PROMISE(type, var, value, info) \
84 type var; \
85 { \
86 v8::TryCatch block; \
87 TONATIVE_VOID_PROMISE_INTERNAL(var, value, info); \
88 }
89
90
91 #define TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState) \
92 var = (value); \
93 if (UNLIKELY(block.HasCaught() || exceptionState.throwIfNeeded())) \
94 return; \
95
96 #define TONATIVE_VOID_EXCEPTIONSTATE(type, var, value, exceptionState) \
97 type var; \
98 { \
99 v8::TryCatch block; \
100 V8RethrowTryCatchScope rethrow(block); \
101 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(var, value, exceptionState); \
102 }
103
104 #define TONATIVE_DEFAULT_EXCEPTIONSTATE(type, var, value, exceptionState, retVal ) \
105 type var; \
106 { \
107 v8::TryCatch block; \
108 V8RethrowTryCatchScope rethrow(block); \
109 var = (value); \
110 if (UNLIKELY(block.HasCaught() || exceptionState.throwIfNeeded())) \
111 return retVal; \
112 }
113
114 // We need to cancel the exception propergation when we return a rejected
115 // Promise.
116 #define TONATIVE_VOID_EXCEPTIONSTATE_PROMISE_INTERNAL(var, value, exceptionState , info, scriptState) \
117 var = (value); \
118 if (UNLIKELY(block.HasCaught())) { \
119 v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), block .Exception())); \
120 block.Reset(); \
121 return; \
122 } \
123 if (UNLIKELY(exceptionState.hadException())) { \
124 v8SetReturnValue(info, exceptionState.reject(scriptState).v8Value()); \
125 return; \
126 }
127
128 #define TONATIVE_VOID_EXCEPTIONSTATE_PROMISE(type, var, value, exceptionState, i nfo, scriptState) \
129 type var; \
130 { \
131 v8::TryCatch block; \
132 TONATIVE_VOID_EXCEPTIONSTATE_PROMISE_INTERNAL(var, value, exceptionState , info, scriptState); \
133 }
134
135 // type is an instance of class template V8StringResource<>,
136 // but Mode argument varies; using type (not Mode) for consistency
137 // with other macros and ease of code generation
138 #define TOSTRING_VOID(type, var, value) \
139 type var(value); \
140 if (UNLIKELY(!var.prepare())) \
141 return;
142
143 #define TOSTRING_VOID_INTERNAL(var, value) \
144 var = (value); \
145 if (UNLIKELY(!var.prepare())) \
146 return;
147
148 #define TOSTRING_DEFAULT(type, var, value, retVal) \
149 type var(value); \
150 if (UNLIKELY(!var.prepare())) \
151 return retVal;
152
153 // We need to cancel the exception propergation when we return a rejected
154 // Promise.
155 #define TOSTRING_VOID_PROMISE_INTERNAL(var, value, info) \
156 var = (value); \
157 if (UNLIKELY(!var.prepare())) { \
158 info.GetReturnValue().Set(ScriptPromise::rejectRaw(info.GetIsolate(), bl ock.Exception())); \
159 block.Reset(); \
160 return; \
161 }
162
163 #define TOSTRING_VOID_PROMISE(type, var, value, info) \
164 type var; \
165 { \
166 v8::TryCatch block; \
167 TOSTRING_VOID_PROMISE_INTERNAL(type, var, value, info); \
168 }
169
170 } // namespace blink
171
172 #endif // SKY_ENGINE_BINDINGS_CORE_V8_V8BINDINGMACROS_H_
OLDNEW
« no previous file with comments | « sky/engine/bindings/core/v8/V8Binding.cpp ('k') | sky/engine/bindings/core/v8/V8CacheOptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698