| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 static DOMDataStore& current(v8::Isolate* isolate) | 59 static DOMDataStore& current(v8::Isolate* isolate) |
| 60 { | 60 { |
| 61 return DOMWrapperWorld::current(isolate).domDataStore(); | 61 return DOMWrapperWorld::current(isolate).domDataStore(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 static bool setReturnValueFast(v8::ReturnValue<v8::Value> returnValue, Scrip
tWrappable* object, v8::Local<v8::Object> holder, const ScriptWrappable* wrappab
le) | 64 static bool setReturnValueFast(v8::ReturnValue<v8::Value> returnValue, Scrip
tWrappable* object, v8::Local<v8::Object> holder, const ScriptWrappable* wrappab
le) |
| 65 { | 65 { |
| 66 // The second fastest way to check if we're in the main world is to chec
k if | 66 // The second fastest way to check if we're in the main world is to chec
k if |
| 67 // the wrappable's wrapper is the same as the holder. | 67 // the wrappable's wrapper is the same as the holder. |
| 68 // FIXME: Investigate if it's worth having this check for performance. | |
| 69 if (holderContainsWrapper(holder, wrappable)) | 68 if (holderContainsWrapper(holder, wrappable)) |
| 70 return object->setReturnValue(returnValue); | 69 return object->setReturnValue(returnValue); |
| 71 return current(returnValue.GetIsolate()).setReturnValueFrom(returnValue,
object); | 70 return current(returnValue.GetIsolate()).setReturnValueFrom(returnValue,
object); |
| 72 } | 71 } |
| 73 | 72 |
| 74 static bool setReturnValueFast(v8::ReturnValue<v8::Value> returnValue, Node*
node, v8::Local<v8::Object> holder, const ScriptWrappable* wrappable) | 73 static bool setReturnValueFast(v8::ReturnValue<v8::Value> returnValue, Node*
node, v8::Local<v8::Object> holder, const ScriptWrappable* wrappable) |
| 75 { | 74 { |
| 76 if (canUseScriptWrappable(node) | 75 if (canUseScriptWrappable(node) |
| 77 // The second fastest way to check if we're in the main world is to | 76 // The second fastest way to check if we're in the main world is to |
| 78 // check if the wrappable's wrapper is the same as the holder. | 77 // check if the wrappable's wrapper is the same as the holder. |
| 79 // FIXME: Investigate if it's worth having this check for performanc
e. | |
| 80 || holderContainsWrapper(holder, wrappable)) | 78 || holderContainsWrapper(holder, wrappable)) |
| 81 return ScriptWrappable::fromNode(node)->setReturnValue(returnValue); | 79 return ScriptWrappable::fromNode(node)->setReturnValue(returnValue); |
| 82 return current(returnValue.GetIsolate()).setReturnValueFrom(returnValue,
ScriptWrappable::fromNode(node)); | 80 return current(returnValue.GetIsolate()).setReturnValueFrom(returnValue,
ScriptWrappable::fromNode(node)); |
| 83 } | 81 } |
| 84 | 82 |
| 85 static bool setReturnValue(v8::ReturnValue<v8::Value> returnValue, ScriptWra
ppableBase* object) | 83 static bool setReturnValue(v8::ReturnValue<v8::Value> returnValue, ScriptWra
ppableBase* object) |
| 86 { | 84 { |
| 87 return current(returnValue.GetIsolate()).setReturnValueFrom(returnValue,
object); | 85 return current(returnValue.GetIsolate()).setReturnValueFrom(returnValue,
object); |
| 88 } | 86 } |
| 89 | 87 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 v8::UniquePersistent<v8::Object> value, | 274 v8::UniquePersistent<v8::Object> value, |
| 277 ScriptWrappableBase* key) | 275 ScriptWrappableBase* key) |
| 278 { | 276 { |
| 279 RELEASE_ASSERT(!value.IsEmpty()); // See crbug.com/368095. | 277 RELEASE_ASSERT(!value.IsEmpty()); // See crbug.com/368095. |
| 280 releaseObject(v8::Local<v8::Object>::New(isolate, value)); | 278 releaseObject(v8::Local<v8::Object>::New(isolate, value)); |
| 281 } | 279 } |
| 282 | 280 |
| 283 } // namespace blink | 281 } // namespace blink |
| 284 | 282 |
| 285 #endif // DOMDataStore_h | 283 #endif // DOMDataStore_h |
| OLD | NEW |