| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 { | 93 { |
| 94 if (UNLIKELY(!impl)) | 94 if (UNLIKELY(!impl)) |
| 95 return v8NullWithCheck(isolate); | 95 return v8NullWithCheck(isolate); |
| 96 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8ArrayBuffer>(impl
, isolate); | 96 v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<V8ArrayBuffer>(impl
, isolate); |
| 97 if (!wrapper.IsEmpty()) | 97 if (!wrapper.IsEmpty()) |
| 98 return wrapper; | 98 return wrapper; |
| 99 return wrap(impl, creationContext, isolate); | 99 return wrap(impl, creationContext, isolate); |
| 100 } | 100 } |
| 101 | 101 |
| 102 template<class CallbackInfo> | 102 template<class CallbackInfo> |
| 103 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ArrayBuffer* impl
, v8::Handle<v8::Object> creationContext) | 103 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, ArrayBuffer* impl
) |
| 104 { | 104 { |
| 105 if (UNLIKELY(!impl)) { | 105 if (UNLIKELY(!impl)) { |
| 106 v8SetReturnValueNull(callbackInfo); | 106 v8SetReturnValueNull(callbackInfo); |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 if (DOMDataStore::setReturnValueFromWrapper<V8ArrayBuffer>(callbackInfo.GetR
eturnValue(), impl)) | 109 if (DOMDataStore::setReturnValueFromWrapper<V8ArrayBuffer>(callbackInfo.GetR
eturnValue(), impl)) |
| 110 return; | 110 return; |
| 111 v8::Handle<v8::Object> wrapper = wrap(impl, creationContext, callbackInfo.Ge
tIsolate()); | 111 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); |
| 112 v8SetReturnValue(callbackInfo, wrapper); | 112 v8SetReturnValue(callbackInfo, wrapper); |
| 113 } | 113 } |
| 114 | 114 |
| 115 template<class CallbackInfo> | 115 template<class CallbackInfo> |
| 116 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Array
Buffer* impl, v8::Handle<v8::Object> creationContext) | 116 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, Array
Buffer* impl) |
| 117 { | 117 { |
| 118 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld); | 118 ASSERT(worldType(callbackInfo.GetIsolate()) == MainWorld); |
| 119 if (UNLIKELY(!impl)) { | 119 if (UNLIKELY(!impl)) { |
| 120 v8SetReturnValueNull(callbackInfo); | 120 v8SetReturnValueNull(callbackInfo); |
| 121 return; | 121 return; |
| 122 } | 122 } |
| 123 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8ArrayBuffer>(callb
ackInfo.GetReturnValue(), impl)) | 123 if (DOMDataStore::setReturnValueFromWrapperForMainWorld<V8ArrayBuffer>(callb
ackInfo.GetReturnValue(), impl)) |
| 124 return; | 124 return; |
| 125 v8::Handle<v8::Value> wrapper = wrap(impl, creationContext, callbackInfo.Get
Isolate()); | 125 v8::Handle<v8::Value> wrapper = wrap(impl, callbackInfo.Holder(), callbackIn
fo.GetIsolate()); |
| 126 v8SetReturnValue(callbackInfo, wrapper); | 126 v8SetReturnValue(callbackInfo, wrapper); |
| 127 } | 127 } |
| 128 | 128 |
| 129 template<class CallbackInfo, class Wrappable> | 129 template<class CallbackInfo, class Wrappable> |
| 130 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ArrayBuffer*
impl, Wrappable* wrappable) | 130 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, ArrayBuffer*
impl, Wrappable* wrappable) |
| 131 { | 131 { |
| 132 if (UNLIKELY(!impl)) { | 132 if (UNLIKELY(!impl)) { |
| 133 v8SetReturnValueNull(callbackInfo); | 133 v8SetReturnValueNull(callbackInfo); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 if (DOMDataStore::setReturnValueFromWrapperFast<V8ArrayBuffer>(callbackInfo.
GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) | 136 if (DOMDataStore::setReturnValueFromWrapperFast<V8ArrayBuffer>(callbackInfo.
GetReturnValue(), impl, callbackInfo.Holder(), wrappable)) |
| 137 return; | 137 return; |
| 138 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); | 138 v8::Handle<v8::Object> wrapper = wrap(impl, callbackInfo.Holder(), callbackI
nfo.GetIsolate()); |
| 139 v8SetReturnValue(callbackInfo, wrapper); | 139 v8SetReturnValue(callbackInfo, wrapper); |
| 140 } | 140 } |
| 141 | 141 |
| 142 inline v8::Handle<v8::Value> toV8(PassRefPtr< ArrayBuffer > impl, v8::Handle<v8:
:Object> creationContext, v8::Isolate* isolate) | 142 inline v8::Handle<v8::Value> toV8(PassRefPtr< ArrayBuffer > impl, v8::Handle<v8:
:Object> creationContext, v8::Isolate* isolate) |
| 143 { | 143 { |
| 144 return toV8(impl.get(), creationContext, isolate); | 144 return toV8(impl.get(), creationContext, isolate); |
| 145 } | 145 } |
| 146 | 146 |
| 147 template<class CallbackInfo> | 147 template<class CallbackInfo> |
| 148 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr< Array
Buffer > impl, v8::Handle<v8::Object> creationContext) | 148 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, PassRefPtr< Array
Buffer > impl) |
| 149 { | 149 { |
| 150 v8SetReturnValue(callbackInfo, impl.get(), creationContext); | 150 v8SetReturnValue(callbackInfo, impl.get()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 template<class CallbackInfo> | 153 template<class CallbackInfo> |
| 154 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassR
efPtr< ArrayBuffer > impl, v8::Handle<v8::Object> creationContext) | 154 inline void v8SetReturnValueForMainWorld(const CallbackInfo& callbackInfo, PassR
efPtr< ArrayBuffer > impl) |
| 155 { | 155 { |
| 156 v8SetReturnValueForMainWorld(callbackInfo, impl.get(), creationContext); | 156 v8SetReturnValueForMainWorld(callbackInfo, impl.get()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 template<class CallbackInfo, class Wrappable> | 159 template<class CallbackInfo, class Wrappable> |
| 160 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr< A
rrayBuffer > impl, Wrappable* wrappable) | 160 inline void v8SetReturnValueFast(const CallbackInfo& callbackInfo, PassRefPtr< A
rrayBuffer > impl, Wrappable* wrappable) |
| 161 { | 161 { |
| 162 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); | 162 v8SetReturnValueFast(callbackInfo, impl.get(), wrappable); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace WebCore | 165 } // namespace WebCore |
| 166 | 166 |
| 167 #endif // V8ArrayBufferCustom_h | 167 #endif // V8ArrayBufferCustom_h |
| OLD | NEW |