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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp

Issue 2817533003: Replace ASSERT, RELEASE_ASSERT, and ASSERT_NOT_REACHED in bindings (Closed)
Patch Set: fixed dcheck build error Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 data_buffer_size_ = byte_length; 120 data_buffer_size_ = byte_length;
121 wire_data.CopyTo(reinterpret_cast<UChar*>(data_buffer_.get()), 0, 121 wire_data.CopyTo(reinterpret_cast<UChar*>(data_buffer_.get()), 0,
122 wire_data.length()); 122 wire_data.length());
123 } 123 }
124 124
125 SerializedScriptValue::~SerializedScriptValue() { 125 SerializedScriptValue::~SerializedScriptValue() {
126 // If the allocated memory was not registered before, then this class is 126 // If the allocated memory was not registered before, then this class is
127 // likely used in a context other than Worker's onmessage environment and the 127 // likely used in a context other than Worker's onmessage environment and the
128 // presence of current v8 context is not guaranteed. Avoid calling v8 then. 128 // presence of current v8 context is not guaranteed. Avoid calling v8 then.
129 if (has_registered_external_allocation_) { 129 if (has_registered_external_allocation_) {
130 ASSERT(v8::Isolate::GetCurrent()); 130 DCHECK(v8::Isolate::GetCurrent());
131 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory( 131 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
132 -static_cast<int64_t>(DataLengthInBytes())); 132 -static_cast<int64_t>(DataLengthInBytes()));
133 } 133 }
134 } 134 }
135 135
136 PassRefPtr<SerializedScriptValue> SerializedScriptValue::NullValue() { 136 PassRefPtr<SerializedScriptValue> SerializedScriptValue::NullValue() {
137 // UChar rather than uint8_t here to get host endian behavior. 137 // UChar rather than uint8_t here to get host endian behavior.
138 static const UChar kNullData[] = {0xff09, 0x3000}; 138 static const UChar kNullData[] = {0xff09, 0x3000};
139 return Create(reinterpret_cast<const char*>(kNullData), sizeof(kNullData)); 139 return Create(reinterpret_cast<const char*>(kNullData), sizeof(kNullData));
140 } 140 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 // Only (re)register allocation cost for transferables if this 462 // Only (re)register allocation cost for transferables if this
463 // SerializedScriptValue has explicitly unregistered them before. 463 // SerializedScriptValue has explicitly unregistered them before.
464 if (array_buffer_contents_array_ && 464 if (array_buffer_contents_array_ &&
465 transferables_need_external_allocation_registration_) { 465 transferables_need_external_allocation_registration_) {
466 for (auto& buffer : *array_buffer_contents_array_) 466 for (auto& buffer : *array_buffer_contents_array_)
467 buffer.RegisterExternalAllocationWithCurrentContext(); 467 buffer.RegisterExternalAllocationWithCurrentContext();
468 } 468 }
469 } 469 }
470 470
471 } // namespace blink 471 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698