summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.cc
blob: 720f112b53d4d53449f86d774424a810c9e60450 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/typed_arrays/dom_shared_array_buffer.h"

#include "third_party/blink/renderer/platform/bindings/dom_data_store.h"

namespace blink {

v8::Local<v8::Value> DOMSharedArrayBuffer::Wrap(
    v8::Isolate* isolate,
    v8::Local<v8::Object> creation_context) {
  DCHECK(!DOMDataStore::ContainsWrapper(this, isolate));

  const WrapperTypeInfo* wrapper_type_info = this->GetWrapperTypeInfo();
  v8::Local<v8::SharedArrayBuffer> wrapper =
      v8::SharedArrayBuffer::New(isolate, Content()->BackingStore());
  wrapper->Externalize(Content()->BackingStore());

  return AssociateWithWrapper(isolate, wrapper_type_info, wrapper);
}

}  // namespace blink