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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.h

Issue 2726593002: Use mayNotBeMainThread() for wrapper optimization (Closed)
Patch Set: Use V8TestingScope Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 template <typename CallbackInfo> 186 template <typename CallbackInfo>
187 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, 187 inline void v8SetReturnValue(const CallbackInfo& callbackInfo,
188 ScriptWrappable* impl) { 188 ScriptWrappable* impl) {
189 v8SetReturnValue(callbackInfo, impl, callbackInfo.Holder()); 189 v8SetReturnValue(callbackInfo, impl, callbackInfo.Holder());
190 } 190 }
191 191
192 template <typename CallbackInfo> 192 template <typename CallbackInfo>
193 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, Node* impl) { 193 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, Node* impl) {
194 if (UNLIKELY(!impl)) { 194 v8SetReturnValue(callbackInfo, ScriptWrappable::fromNode(impl));
195 v8SetReturnValueNull(callbackInfo);
196 return;
197 }
198 if (DOMDataStore::setReturnValue(callbackInfo.GetReturnValue(), impl))
199 return;
200 v8::Local<v8::Object> wrapper = ScriptWrappable::fromNode(impl)->wrap(
201 callbackInfo.GetIsolate(), callbackInfo.Holder());
202 v8SetReturnValue(callbackInfo, wrapper);
203 } 195 }
204 196
205 // Special versions for DOMWindow and EventTarget 197 // Special versions for DOMWindow and EventTarget
206 198
207 template <typename CallbackInfo> 199 template <typename CallbackInfo>
208 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, 200 inline void v8SetReturnValue(const CallbackInfo& callbackInfo,
209 DOMWindow* impl) { 201 DOMWindow* impl) {
210 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), 202 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(),
211 callbackInfo.GetIsolate())); 203 callbackInfo.GetIsolate()));
212 } 204 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 return; 291 return;
300 v8::Local<v8::Object> wrapper = 292 v8::Local<v8::Object> wrapper =
301 impl->wrap(callbackInfo.GetIsolate(), callbackInfo.Holder()); 293 impl->wrap(callbackInfo.GetIsolate(), callbackInfo.Holder());
302 v8SetReturnValue(callbackInfo, wrapper); 294 v8SetReturnValue(callbackInfo, wrapper);
303 } 295 }
304 296
305 template <typename CallbackInfo> 297 template <typename CallbackInfo>
306 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, 298 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo,
307 Node* impl, 299 Node* impl,
308 const ScriptWrappable* wrappable) { 300 const ScriptWrappable* wrappable) {
309 if (UNLIKELY(!impl)) { 301 v8SetReturnValueFast(callbackInfo, ScriptWrappable::fromNode(impl),
310 v8SetReturnValueNull(callbackInfo); 302 wrappable);
311 return;
312 }
313 if (DOMDataStore::setReturnValueFast(callbackInfo.GetReturnValue(), impl,
314 callbackInfo.Holder(), wrappable))
315 return;
316 v8::Local<v8::Object> wrapper = ScriptWrappable::fromNode(impl)->wrap(
317 callbackInfo.GetIsolate(), callbackInfo.Holder());
318 v8SetReturnValue(callbackInfo, wrapper);
319 } 303 }
320 304
321 // Special versions for DOMWindow and EventTarget 305 // Special versions for DOMWindow and EventTarget
322 306
323 template <typename CallbackInfo> 307 template <typename CallbackInfo>
324 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, 308 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo,
325 DOMWindow* impl, 309 DOMWindow* impl,
326 const ScriptWrappable*) { 310 const ScriptWrappable*) {
327 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), 311 v8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(),
328 callbackInfo.GetIsolate())); 312 callbackInfo.GetIsolate()));
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 // If the argument isn't an object, this will crash. 1148 // If the argument isn't an object, this will crash.
1165 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, 1149 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>,
1166 v8::Isolate*); 1150 v8::Isolate*);
1167 1151
1168 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, 1152 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*,
1169 const String& stringifiedJSON, 1153 const String& stringifiedJSON,
1170 ExceptionState&); 1154 ExceptionState&);
1171 } // namespace blink 1155 } // namespace blink
1172 1156
1173 #endif // V8Binding_h 1157 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ToV8.h ('k') | third_party/WebKit/Source/bindings/core/v8/V8DOMWrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698