OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef FileWriter_h | 31 #ifndef FileWriter_h |
32 #define FileWriter_h | 32 #define FileWriter_h |
33 | 33 |
| 34 #include "bindings/core/v8/ActiveScriptWrappable.h" |
34 #include "core/dom/ActiveDOMObject.h" | 35 #include "core/dom/ActiveDOMObject.h" |
35 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
36 #include "core/fileapi/FileError.h" | 37 #include "core/fileapi/FileError.h" |
37 #include "modules/EventTargetModules.h" | 38 #include "modules/EventTargetModules.h" |
38 #include "modules/filesystem/FileWriterBase.h" | 39 #include "modules/filesystem/FileWriterBase.h" |
39 #include "platform/heap/Handle.h" | 40 #include "platform/heap/Handle.h" |
40 #include "public/platform/WebFileWriterClient.h" | 41 #include "public/platform/WebFileWriterClient.h" |
41 | 42 |
42 namespace blink { | 43 namespace blink { |
43 | 44 |
44 class Blob; | 45 class Blob; |
45 class ExceptionState; | 46 class ExceptionState; |
46 class ExecutionContext; | 47 class ExecutionContext; |
47 | 48 |
48 class FileWriter final | 49 class FileWriter final |
49 #if ENABLE(OILPAN) | 50 #if ENABLE(OILPAN) |
50 : public EventTargetWithInlineData | 51 : public EventTargetWithInlineData |
51 , public FileWriterBase | 52 , public FileWriterBase |
52 #else | 53 #else |
53 : public FileWriterBase | 54 : public FileWriterBase |
54 , public EventTargetWithInlineData | 55 , public EventTargetWithInlineData |
55 #endif | 56 #endif |
| 57 , public ActiveScriptWrappable |
56 , public ActiveDOMObject | 58 , public ActiveDOMObject |
57 , public WebFileWriterClient { | 59 , public WebFileWriterClient { |
58 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(FileWriterBase); | 60 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(FileWriterBase); |
59 DEFINE_WRAPPERTYPEINFO(); | 61 DEFINE_WRAPPERTYPEINFO(); |
60 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileWriter); | 62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileWriter); |
61 public: | 63 public: |
62 static FileWriter* create(ExecutionContext*); | 64 static FileWriter* create(ExecutionContext*); |
63 ~FileWriter() override; | 65 ~FileWriter() override; |
64 | 66 |
65 enum ReadyState { | 67 enum ReadyState { |
66 INIT = 0, | 68 INIT = 0, |
67 WRITING = 1, | 69 WRITING = 1, |
68 DONE = 2 | 70 DONE = 2 |
69 }; | 71 }; |
70 | 72 |
71 void write(Blob*, ExceptionState&); | 73 void write(Blob*, ExceptionState&); |
72 void seek(long long position, ExceptionState&); | 74 void seek(long long position, ExceptionState&); |
73 void truncate(long long length, ExceptionState&); | 75 void truncate(long long length, ExceptionState&); |
74 void abort(ExceptionState&); | 76 void abort(ExceptionState&); |
75 ReadyState getReadyState() const { return m_readyState; } | 77 ReadyState getReadyState() const { return m_readyState; } |
76 FileError* error() const { return m_error.get(); } | 78 FileError* error() const { return m_error.get(); } |
77 | 79 |
78 // WebFileWriterClient | 80 // WebFileWriterClient |
79 void didWrite(long long bytes, bool complete) override; | 81 void didWrite(long long bytes, bool complete) override; |
80 void didTruncate() override; | 82 void didTruncate() override; |
81 void didFail(WebFileError) override; | 83 void didFail(WebFileError) override; |
82 | 84 |
83 // ActiveDOMObject | 85 // ActiveDOMObject |
84 void stop() override; | 86 void stop() override; |
85 bool hasPendingActivity() const override; | 87 |
| 88 // ActiveScriptWrappable |
| 89 bool hasPendingActivity() const final; |
86 | 90 |
87 // EventTarget | 91 // EventTarget |
88 const AtomicString& interfaceName() const override; | 92 const AtomicString& interfaceName() const override; |
89 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj
ect::getExecutionContext(); } | 93 ExecutionContext* getExecutionContext() const override { return ActiveDOMObj
ect::getExecutionContext(); } |
90 | 94 |
91 DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); | 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); |
92 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); | 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); |
93 DEFINE_ATTRIBUTE_EVENT_LISTENER(write); | 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(write); |
94 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
95 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 long long m_numAborts; | 131 long long m_numAborts; |
128 long long m_recursionDepth; | 132 long long m_recursionDepth; |
129 double m_lastProgressNotificationTimeMS; | 133 double m_lastProgressNotificationTimeMS; |
130 Member<Blob> m_blobBeingWritten; | 134 Member<Blob> m_blobBeingWritten; |
131 int m_asyncOperationId; | 135 int m_asyncOperationId; |
132 }; | 136 }; |
133 | 137 |
134 } // namespace blink | 138 } // namespace blink |
135 | 139 |
136 #endif // FileWriter_h | 140 #endif // FileWriter_h |
OLD | NEW |