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

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

Issue 2815793002: [SharedArrayBuffer] Add "AllowShared" extended attribute, used for WebGL (Closed)
Patch Set: add layout tests Created 3 years, 8 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 29 matching lines...) Expand all
40 #include "bindings/core/v8/ScriptState.h" 40 #include "bindings/core/v8/ScriptState.h"
41 #include "bindings/core/v8/ScriptValue.h" 41 #include "bindings/core/v8/ScriptValue.h"
42 #include "bindings/core/v8/ScriptWrappable.h" 42 #include "bindings/core/v8/ScriptWrappable.h"
43 #include "bindings/core/v8/V8BindingMacros.h" 43 #include "bindings/core/v8/V8BindingMacros.h"
44 #include "bindings/core/v8/V8PerIsolateData.h" 44 #include "bindings/core/v8/V8PerIsolateData.h"
45 #include "bindings/core/v8/V8ScriptRunner.h" 45 #include "bindings/core/v8/V8ScriptRunner.h"
46 #include "bindings/core/v8/V8StringResource.h" 46 #include "bindings/core/v8/V8StringResource.h"
47 #include "bindings/core/v8/V8ThrowException.h" 47 #include "bindings/core/v8/V8ThrowException.h"
48 #include "bindings/core/v8/V8ValueCache.h" 48 #include "bindings/core/v8/V8ValueCache.h"
49 #include "core/CoreExport.h" 49 #include "core/CoreExport.h"
50 #include "core/dom/NotShared.h" 50 #include "core/dom/ArrayBufferViewHelpers.h"
51 #include "platform/heap/Handle.h" 51 #include "platform/heap/Handle.h"
52 #include "platform/wtf/text/AtomicString.h" 52 #include "platform/wtf/text/AtomicString.h"
53 #include "platform/wtf/text/StringView.h" 53 #include "platform/wtf/text/StringView.h"
54 #include "v8/include/v8.h" 54 #include "v8/include/v8.h"
55 55
56 namespace blink { 56 namespace blink {
57 57
58 class DOMWindow; 58 class DOMWindow;
59 class EventListener; 59 class EventListener;
60 class EventTarget; 60 class EventTarget;
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 DOMTypedArray* dom_typed_array = 1189 DOMTypedArray* dom_typed_array =
1190 V8TypeOf<DOMTypedArray>::Type::toImplWithTypeCheck(isolate, value); 1190 V8TypeOf<DOMTypedArray>::Type::toImplWithTypeCheck(isolate, value);
1191 if (dom_typed_array && dom_typed_array->IsShared()) { 1191 if (dom_typed_array && dom_typed_array->IsShared()) {
1192 exception_state.ThrowTypeError( 1192 exception_state.ThrowTypeError(
1193 "The provided ArrayBufferView value must not be shared."); 1193 "The provided ArrayBufferView value must not be shared.");
1194 return NotSharedType(); 1194 return NotSharedType();
1195 } 1195 }
1196 return NotSharedType(dom_typed_array); 1196 return NotSharedType(dom_typed_array);
1197 } 1197 }
1198 1198
1199 // Wrap a typed array value in MaybeShared<>, to signify that it may be backed
1200 // by a SharedArrayBuffer.
1201 template <typename MaybeSharedType>
1202 MaybeSharedType ToMaybeShared(v8::Isolate* isolate,
1203 v8::Local<v8::Value> value,
1204 ExceptionState& exception_state) {
1205 using DOMTypedArray = typename MaybeSharedType::TypedArrayType;
1206 DOMTypedArray* dom_typed_array =
1207 V8TypeOf<DOMTypedArray>::Type::toImplWithTypeCheck(isolate, value);
1208 return MaybeSharedType(dom_typed_array);
1209 }
1210
1199 } // namespace blink 1211 } // namespace blink
1200 1212
1201 #endif // V8Binding_h 1213 #endif // V8Binding_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698