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

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

Issue 2834463002: Move CreateDOMException out of V8ThrowException (Closed)
Patch Set: Add comments 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/serialization/V8ScriptValueSerializer.h" 5 #include "bindings/core/v8/serialization/V8ScriptValueSerializer.h"
6 6
7 #include "bindings/core/v8/ToV8ForCore.h" 7 #include "bindings/core/v8/ToV8ForCore.h"
8 #include "bindings/core/v8/V8Blob.h" 8 #include "bindings/core/v8/V8Blob.h"
9 #include "bindings/core/v8/V8CompositorProxy.h" 9 #include "bindings/core/v8/V8CompositorProxy.h"
10 #include "bindings/core/v8/V8File.h" 10 #include "bindings/core/v8/V8File.h"
11 #include "bindings/core/v8/V8FileList.h" 11 #include "bindings/core/v8/V8FileList.h"
12 #include "bindings/core/v8/V8ImageBitmap.h" 12 #include "bindings/core/v8/V8ImageBitmap.h"
13 #include "bindings/core/v8/V8ImageData.h" 13 #include "bindings/core/v8/V8ImageData.h"
14 #include "bindings/core/v8/V8MessagePort.h" 14 #include "bindings/core/v8/V8MessagePort.h"
15 #include "bindings/core/v8/V8OffscreenCanvas.h" 15 #include "bindings/core/v8/V8OffscreenCanvas.h"
16 #include "bindings/core/v8/V8SharedArrayBuffer.h" 16 #include "bindings/core/v8/V8SharedArrayBuffer.h"
17 #include "bindings/core/v8/V8ThrowDOMException.h"
17 #include "core/dom/DOMArrayBufferBase.h" 18 #include "core/dom/DOMArrayBufferBase.h"
18 #include "core/html/ImageData.h" 19 #include "core/html/ImageData.h"
19 #include "platform/RuntimeEnabledFeatures.h" 20 #include "platform/RuntimeEnabledFeatures.h"
20 #include "platform/wtf/AutoReset.h" 21 #include "platform/wtf/AutoReset.h"
21 #include "platform/wtf/DateMath.h" 22 #include "platform/wtf/DateMath.h"
22 #include "platform/wtf/allocator/Partitions.h" 23 #include "platform/wtf/allocator/Partitions.h"
23 #include "platform/wtf/text/StringUTF8Adaptor.h" 24 #include "platform/wtf/text/StringUTF8Adaptor.h"
24 #include "public/platform/WebBlobInfo.h" 25 #include "public/platform/WebBlobInfo.h"
25 26
26 namespace blink { 27 namespace blink {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 WriteUint32(file->GetUserVisibility() == File::kIsUserVisible ? 1 : 0); 357 WriteUint32(file->GetUserVisibility() == File::kIsUserVisible ? 1 : 0);
357 } 358 }
358 return true; 359 return true;
359 } 360 }
360 361
361 void V8ScriptValueSerializer::ThrowDataCloneError( 362 void V8ScriptValueSerializer::ThrowDataCloneError(
362 v8::Local<v8::String> v8_message) { 363 v8::Local<v8::String> v8_message) {
363 DCHECK(exception_state_); 364 DCHECK(exception_state_);
364 String message = exception_state_->AddExceptionContext( 365 String message = exception_state_->AddExceptionContext(
365 V8StringToWebCoreString<String>(v8_message, kDoNotExternalize)); 366 V8StringToWebCoreString<String>(v8_message, kDoNotExternalize));
366 v8::Local<v8::Value> exception = V8ThrowException::CreateDOMException( 367 V8ThrowDOMException::ThrowDOMException(script_state_->GetIsolate(),
367 script_state_->GetIsolate(), kDataCloneError, message); 368 kDataCloneError, message);
368 V8ThrowException::ThrowException(script_state_->GetIsolate(), exception);
369 } 369 }
370 370
371 v8::Maybe<bool> V8ScriptValueSerializer::WriteHostObject( 371 v8::Maybe<bool> V8ScriptValueSerializer::WriteHostObject(
372 v8::Isolate* isolate, 372 v8::Isolate* isolate,
373 v8::Local<v8::Object> object) { 373 v8::Local<v8::Object> object) {
374 DCHECK(exception_state_); 374 DCHECK(exception_state_);
375 DCHECK_EQ(isolate, script_state_->GetIsolate()); 375 DCHECK_EQ(isolate, script_state_->GetIsolate());
376 ExceptionState exception_state(isolate, exception_state_->Context(), 376 ExceptionState exception_state(isolate, exception_state_->Context(),
377 exception_state_->InterfaceName(), 377 exception_state_->InterfaceName(),
378 exception_state_->PropertyName()); 378 exception_state_->PropertyName());
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 *actual_size = WTF::Partitions::BufferActualSize(size); 447 *actual_size = WTF::Partitions::BufferActualSize(size);
448 return WTF::Partitions::BufferRealloc(old_buffer, *actual_size, 448 return WTF::Partitions::BufferRealloc(old_buffer, *actual_size,
449 "SerializedScriptValue buffer"); 449 "SerializedScriptValue buffer");
450 } 450 }
451 451
452 void V8ScriptValueSerializer::FreeBufferMemory(void* buffer) { 452 void V8ScriptValueSerializer::FreeBufferMemory(void* buffer) {
453 return WTF::Partitions::BufferFree(buffer); 453 return WTF::Partitions::BufferFree(buffer);
454 } 454 }
455 455
456 } // namespace blink 456 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698