1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 #include "core/dom/DOMArrayBufferDeallocationObserver.h"
8 #include "wtf/Threading.h"
13 DOMArrayBufferDeallocationObserver* DOMArrayBufferDeallocationObserver::instance()
15 AtomicallyInitializedStatic(
16 DOMArrayBufferDeallocationObserver*,
17 deallocationObserver = new DOMArrayBufferDeallocationObserver);
18 return deallocationObserver;
21 void DOMArrayBufferDeallocationObserver::arrayBufferDeallocated(unsigned sizeInBytes)
23 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-static_cast<int>(sizeInBytes));
26 void DOMArrayBufferDeallocationObserver::blinkAllocatedMemory(unsigned sizeInBytes)
28 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(static_cast<int>(sizeInBytes));