Bug 1079844 - Rename ABO::neuterView to a standalone NoteViewBufferWasDetached function. r=sfink

--HG--
extra : rebase_source : e89faa67641db7e4e35f055a0ee8faefbe4c25f5
This commit is contained in:
Jeff Walden 2016-01-25 14:01:13 -08:00
Родитель 48a7b7eee7
Коммит 4ecf86dba5
2 изменённых файлов: 6 добавлений и 7 удалений

Просмотреть файл

@ -239,9 +239,10 @@ AllocateArrayBufferContents(JSContext* cx, uint32_t nbytes)
return ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(p); return ArrayBufferObject::BufferContents::create<ArrayBufferObject::PLAIN>(p);
} }
void static void
ArrayBufferObject::neuterView(JSContext* cx, ArrayBufferViewObject* view, NoteViewBufferWasDetached(ArrayBufferViewObject* view,
BufferContents newContents) ArrayBufferObject::BufferContents newContents,
JSContext* cx)
{ {
view->notifyBufferDetached(newContents.data()); view->notifyBufferDetached(newContents.data());
@ -283,7 +284,7 @@ ArrayBufferObject::detach(JSContext* cx, Handle<ArrayBufferObject*> buffer,
if (InnerViewTable::ViewVector* views = cx->compartment()->innerViews.maybeViewsUnbarriered(buffer)) { if (InnerViewTable::ViewVector* views = cx->compartment()->innerViews.maybeViewsUnbarriered(buffer)) {
for (size_t i = 0; i < views->length(); i++) for (size_t i = 0; i < views->length(); i++)
buffer->neuterView(cx, (*views)[i], newContents); NoteViewBufferWasDetached((*views)[i], newContents, cx);
cx->compartment()->innerViews.removeViews(buffer); cx->compartment()->innerViews.removeViews(buffer);
} }
if (buffer->firstView()) { if (buffer->firstView()) {
@ -292,7 +293,7 @@ ArrayBufferObject::detach(JSContext* cx, Handle<ArrayBufferObject*> buffer,
// this pointer alive we don't clear out the first view. // this pointer alive we don't clear out the first view.
MOZ_ASSERT(buffer->firstView()->is<InlineTransparentTypedObject>()); MOZ_ASSERT(buffer->firstView()->is<InlineTransparentTypedObject>());
} else { } else {
buffer->neuterView(cx, buffer->firstView(), newContents); NoteViewBufferWasDetached(buffer->firstView(), newContents, cx);
buffer->setFirstView(nullptr); buffer->setFirstView(nullptr);
} }
} }

Просмотреть файл

@ -279,8 +279,6 @@ class ArrayBufferObject : public ArrayBufferObjectMaybeShared
detach(JSContext* cx, Handle<ArrayBufferObject*> buffer, BufferContents newContents); detach(JSContext* cx, Handle<ArrayBufferObject*> buffer, BufferContents newContents);
private: private:
void neuterView(JSContext* cx, ArrayBufferViewObject* view,
BufferContents newContents);
void changeViewContents(JSContext* cx, ArrayBufferViewObject* view, void changeViewContents(JSContext* cx, ArrayBufferViewObject* view,
uint8_t* oldDataPointer, BufferContents newContents); uint8_t* oldDataPointer, BufferContents newContents);
void setFirstView(ArrayBufferViewObject* view); void setFirstView(ArrayBufferViewObject* view);