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

Unified Diff: Source/wtf/ArrayBufferContents.cpp

Issue 1532413002: Added Dartium changes onto 45.0.2454.104 (Closed) Base URL: http://src.chromium.org/blink/branches/chromium/2454
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: Source/wtf/ArrayBufferContents.cpp
diff --git a/Source/wtf/ArrayBufferContents.cpp b/Source/wtf/ArrayBufferContents.cpp
index 2d03a4107e9fc6fee62e13be1ee3dada0c297b12..4b29a8212d889614e5bb99991c87f5f133c34526 100644
--- a/Source/wtf/ArrayBufferContents.cpp
+++ b/Source/wtf/ArrayBufferContents.cpp
@@ -59,6 +59,7 @@ ArrayBufferContents::ArrayBufferContents(
{
if (data) {
m_holder->adopt(data, sizeInBytes, isShared);
+ m_holder->setAllocated(false);
} else {
ASSERT(!sizeInBytes);
sizeInBytes = 0;
@@ -116,16 +117,19 @@ void ArrayBufferContents::freeMemory(void* data, size_t size)
ArrayBufferContents::DataHolder::DataHolder()
: m_data(nullptr)
+ , m_malloc(false)
, m_sizeInBytes(0)
, m_isShared(NotShared) { }
ArrayBufferContents::DataHolder::~DataHolder()
{
- ArrayBufferContents::freeMemory(m_data, m_sizeInBytes);
+ if (m_malloc)
+ ArrayBufferContents::freeMemory(m_data, m_sizeInBytes);
m_data = nullptr;
m_sizeInBytes = 0;
m_isShared = NotShared;
+ m_malloc = false;
}
void ArrayBufferContents::DataHolder::allocateNew(unsigned sizeInBytes, SharingType isShared, InitializationPolicy policy)
@@ -136,6 +140,7 @@ void ArrayBufferContents::DataHolder::allocateNew(unsigned sizeInBytes, SharingT
m_data = data;
m_sizeInBytes = data ? sizeInBytes : 0;
m_isShared = isShared;
+ m_malloc = true;
}
void ArrayBufferContents::DataHolder::adopt(void* data, unsigned sizeInBytes, SharingType isShared)
« no previous file with comments | « Source/wtf/ArrayBufferContents.h ('k') | Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698