Skip to content

Commit

Permalink
Pass the array buffer allocator to gin
Browse files Browse the repository at this point in the history
BUG=none
R=dslomov@chromium.org,abarth@chromium.org

Review URL: https://codereview.chromium.org/172163002

git-svn-id: svn://svn.chromium.org/blink/trunk@167523 bbb929c8-8fbe-4397-9dbb-9b2b20218538
  • Loading branch information
jochen@chromium.org committed Feb 20, 2014
1 parent e505121 commit fa5cc20
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion third_party/WebKit/Source/bindings/v8/V8PerIsolateData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ V8PerIsolateData::V8PerIsolateData(v8::Isolate* isolate)
, m_performingMicrotaskCheckpoint(false)
{
if (m_isMainThread)
mainIsolateHolder = new gin::IsolateHolder(m_isolate);
mainIsolateHolder = new gin::IsolateHolder(m_isolate, v8ArrayBufferAllocator());
}

V8PerIsolateData::~V8PerIsolateData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ WorkerScriptController::WorkerScriptController(WorkerGlobalScope& workerGlobalSc
isolate->Enter();
V8Initializer::initializeWorker(isolate);
v8::V8::Initialize();
m_isolateHolder = adoptPtr(new gin::IsolateHolder(isolate));
m_isolateHolder = adoptPtr(new gin::IsolateHolder(isolate, v8ArrayBufferAllocator()));
V8PerIsolateData::ensureInitialized(isolate);
m_world = DOMWrapperWorld::create(WorkerWorldId, -1);
m_interruptor = adoptPtr(new V8IsolateInterruptor(isolate));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,19 @@ v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl
ArrayBuffer* V8ArrayBuffer::toNative(v8::Handle<v8::Object> object)
{
ASSERT(object->IsArrayBuffer());
void* arraybufferPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex);
if (arraybufferPtr)
return reinterpret_cast<ArrayBuffer*>(arraybufferPtr);

v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>();
ASSERT(!v8buffer->IsExternal());
if (v8buffer->IsExternal()) {
RELEASE_ASSERT(toWrapperTypeInfo(object)->ginEmbedder == gin::kEmbedderBlink);
return reinterpret_cast<ArrayBuffer*>(WebCore::toNative(object));
}

v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize();
ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(),
V8ArrayBufferDeallocationObserver::instanceTemplate());
RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(contents);
V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(buffer.release(), &wrapperTypeInfo, object, v8::Isolate::GetCurrent(), WrapperConfiguration::Dependent);

arraybufferPtr = object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex);
ASSERT(arraybufferPtr);
return reinterpret_cast<ArrayBuffer*>(arraybufferPtr);
return reinterpret_cast<ArrayBuffer*>(WebCore::toNative(object));
}

ArrayBuffer* V8ArrayBuffer::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
Expand Down

0 comments on commit fa5cc20

Please sign in to comment.