OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef SerializedScriptValueFactory_h | |
6 #define SerializedScriptValueFactory_h | |
7 | |
8 #include "bindings/core/v8/SerializedScriptValue.h" | |
9 #include "wtf/Noncopyable.h" | |
10 | |
11 namespace blink { | |
12 | |
13 class SerializedScriptValueFactory { | |
14 WTF_MAKE_NONCOPYABLE(SerializedScriptValueFactory); | |
15 public: | |
16 SerializedScriptValueFactory() { } | |
17 | |
18 // If a serialization error occurs (e.g., cyclic input value) this | |
19 // function returns an empty representation, schedules a V8 exception to | |
20 // be thrown using v8::ThrowException(), and sets |didThrow|. In this case | |
21 // the caller must not invoke any V8 operations until control returns to | |
22 // V8. When serialization is successful, |didThrow| is false. | |
23 virtual PassRefPtr<SerializedScriptValue> create(v8::Handle<v8::Value>, Mess agePortArray*, ArrayBufferArray*, ExceptionState&, v8::Isolate*); | |
24 virtual PassRefPtr<SerializedScriptValue> createFromWire(const String&); | |
25 PassRefPtr<SerializedScriptValue> createFromWireBytes(const Vector<uint8_t>& ); | |
26 PassRefPtr<SerializedScriptValue> create(const String&); | |
27 virtual PassRefPtr<SerializedScriptValue> create(const String&, v8::Isolate* ); | |
28 virtual PassRefPtr<SerializedScriptValue> create(); | |
29 virtual PassRefPtr<SerializedScriptValue> create(const ScriptValue&, WebBlob InfoArray*, ExceptionState&, v8::Isolate*); | |
30 | |
31 // Never throws exceptions. | |
32 PassRefPtr<SerializedScriptValue> createAndSwallowExceptions(v8::Isolate*, v 8::Handle<v8::Value>); | |
33 | |
34 static SerializedScriptValueFactory& factory() | |
35 { | |
haraken
2014/11/17 01:27:49
Shouldn't this be ASSERT_NOT_REACHED()?
I guess S
tasak
2014/11/17 08:42:30
Done.
| |
36 if (!m_singleton) | |
37 m_singleton = new SerializedScriptValueFactory(); | |
38 return *m_singleton; | |
39 } | |
40 | |
41 static void initialize(SerializedScriptValueFactory* newFactory) | |
tasak
2014/11/14 08:07:39
initialize is invoked when Blink is initlized. i.e
haraken
2014/11/17 01:27:50
Add a comment about this behavior.
tasak
2014/11/17 08:42:30
Done.
| |
42 { | |
43 ASSERT(!m_singleton); | |
44 m_singleton = newFactory; | |
45 } | |
46 | |
47 private: | |
48 static SerializedScriptValueFactory* m_singleton; | |
49 }; | |
50 | |
51 } // namespace blink | |
52 | |
53 #endif // SerializedScriptValueFactory_h | |
54 | |
OLD | NEW |