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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValueFactory.h

Issue 1893983002: Simplify handling of Transferable objects while (de)serializing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove Transferable.cpp, not needed after all. Created 4 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 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef SerializedScriptValueFactory_h 5 #ifndef SerializedScriptValueFactory_h
6 #define SerializedScriptValueFactory_h 6 #define SerializedScriptValueFactory_h
7 7
8 #include "bindings/core/v8/ScriptValueSerializer.h" 8 #include "bindings/core/v8/ScriptValueSerializer.h"
9 #include "bindings/core/v8/SerializedScriptValue.h" 9 #include "bindings/core/v8/SerializedScriptValue.h"
10 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
11 #include "wtf/Allocator.h" 11 #include "wtf/Allocator.h"
12 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class CORE_EXPORT SerializedScriptValueFactory { 16 class CORE_EXPORT SerializedScriptValueFactory {
17 WTF_MAKE_NONCOPYABLE(SerializedScriptValueFactory); 17 WTF_MAKE_NONCOPYABLE(SerializedScriptValueFactory);
18 USING_FAST_MALLOC(SerializedScriptValueFactory); 18 USING_FAST_MALLOC(SerializedScriptValueFactory);
19 public: 19 public:
20 SerializedScriptValueFactory() { } 20 SerializedScriptValueFactory() { }
21 21
22 // If a serialization error occurs (e.g., cyclic input value) this 22 // If a serialization error occurs (e.g., cyclic input value) this
23 // function returns an empty representation, schedules a V8 exception to 23 // function returns an empty representation, schedules a V8 exception to
24 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case 24 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case
25 // the caller must not invoke any V8 operations until control returns to 25 // the caller must not invoke any V8 operations until control returns to
26 // V8. When serialization is successful, |didThrow| is false. 26 // V8. When serialization is successful, |didThrow| is false.
27 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8: :Value>, TransferableArray*, WebBlobInfoArray*, ExceptionState&); 27 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8: :Value>, Transferables*, WebBlobInfoArray*, ExceptionState&);
28 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>, TransferableArray*, ExceptionState&); 28 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, v8::Local<v8::Value>, Transferables*, ExceptionState&);
29 PassRefPtr<SerializedScriptValue> createFromWire(const String&); 29 PassRefPtr<SerializedScriptValue> createFromWire(const String&);
30 PassRefPtr<SerializedScriptValue> createFromWireBytes(const char* data, size _t length); 30 PassRefPtr<SerializedScriptValue> createFromWireBytes(const char* data, size _t length);
31 PassRefPtr<SerializedScriptValue> create(const String&); 31 PassRefPtr<SerializedScriptValue> create(const String&);
32 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const String& ); 32 virtual PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const String& );
33 PassRefPtr<SerializedScriptValue> create(); 33 PassRefPtr<SerializedScriptValue> create();
34 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const ScriptValue&, W ebBlobInfoArray*, ExceptionState&); 34 PassRefPtr<SerializedScriptValue> create(v8::Isolate*, const ScriptValue&, W ebBlobInfoArray*, ExceptionState&);
35 35
36 // Never throws exceptions. 36 // Never throws exceptions.
37 PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v 8::Local<v8::Value>); 37 PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v 8::Local<v8::Value>);
38 38
(...skipping 10 matching lines...) Expand all
49 49
50 // SerializedScriptValueFactory::initialize() should be invoked when Blink i s initialized, 50 // SerializedScriptValueFactory::initialize() should be invoked when Blink i s initialized,
51 // i.e. initialize() in WebKit.cpp. 51 // i.e. initialize() in WebKit.cpp.
52 static void initialize(SerializedScriptValueFactory* newFactory) 52 static void initialize(SerializedScriptValueFactory* newFactory)
53 { 53 {
54 ASSERT(!m_instance); 54 ASSERT(!m_instance);
55 m_instance = newFactory; 55 m_instance = newFactory;
56 } 56 }
57 57
58 protected: 58 protected:
59 ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, SerializedSc riptValueWriter&, TransferableArray*, WebBlobInfoArray*, SerializedScriptValue*, v8::TryCatch&, String& errorMessage, v8::Isolate*); 59 ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, SerializedSc riptValueWriter&, Transferables*, WebBlobInfoArray*, SerializedScriptValue*, v8: :TryCatch&, String& errorMessage, v8::Isolate*);
60 virtual ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, Seri alizedScriptValueWriter&, TransferableArray*, WebBlobInfoArray*, BlobDataHandleM ap&, v8::TryCatch&, String& errorMessage, v8::Isolate*); 60 virtual ScriptValueSerializer::Status doSerialize(v8::Local<v8::Value>, Seri alizedScriptValueWriter&, Transferables*, WebBlobInfoArray*, BlobDataHandleMap&, v8::TryCatch&, String& errorMessage, v8::Isolate*);
61 void transferData(SerializedScriptValue*, SerializedScriptValueWriter&, Tran sferableArray*, ExceptionState&, v8::Isolate*); 61 void transferData(SerializedScriptValue*, SerializedScriptValueWriter&, Tran sferables*, ExceptionState&, v8::Isolate*);
62 62
63 virtual v8::Local<v8::Value> deserialize(String& data, BlobDataHandleMap& bl obDataHandles, ArrayBufferContentsArray*, ImageBitmapContentsArray*, v8::Isolate *, MessagePortArray* messagePorts, const WebBlobInfoArray*); 63 virtual v8::Local<v8::Value> deserialize(String& data, BlobDataHandleMap& bl obDataHandles, ArrayBufferContentsArray*, ImageBitmapContentsArray*, v8::Isolate *, MessagePortArray* messagePorts, const WebBlobInfoArray*);
64 64
65 private: 65 private:
66 static SerializedScriptValueFactory* m_instance; 66 static SerializedScriptValueFactory* m_instance;
67 }; 67 };
68 68
69 } // namespace blink 69 } // namespace blink
70 70
71 #endif // SerializedScriptValueFactory_h 71 #endif // SerializedScriptValueFactory_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698