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 20 matching lines...) Expand all Loading... |
31 #ifndef FileWriter_h | 31 #ifndef FileWriter_h |
32 #define FileWriter_h | 32 #define FileWriter_h |
33 | 33 |
34 #include "core/dom/ActiveDOMObject.h" | 34 #include "core/dom/ActiveDOMObject.h" |
35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
36 #include "core/fileapi/FileError.h" | 36 #include "core/fileapi/FileError.h" |
37 #include "modules/EventTargetModules.h" | 37 #include "modules/EventTargetModules.h" |
38 #include "modules/filesystem/FileWriterBase.h" | 38 #include "modules/filesystem/FileWriterBase.h" |
39 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
40 #include "public/platform/WebFileWriterClient.h" | 40 #include "public/platform/WebFileWriterClient.h" |
41 #include "wtf/RefPtr.h" | |
42 | 41 |
43 namespace blink { | 42 namespace blink { |
44 | 43 |
45 class Blob; | 44 class Blob; |
46 class ExceptionState; | 45 class ExceptionState; |
47 class ExecutionContext; | 46 class ExecutionContext; |
48 | 47 |
49 class FileWriter final | 48 class FileWriter final |
50 #if ENABLE(OILPAN) | 49 #if ENABLE(OILPAN) |
51 : public EventTargetWithInlineData | 50 : public EventTargetWithInlineData |
52 , public FileWriterBase | 51 , public FileWriterBase |
53 #else | 52 #else |
54 : public FileWriterBase | 53 : public FileWriterBase |
55 , public EventTargetWithInlineData | 54 , public EventTargetWithInlineData |
56 #endif | 55 #endif |
57 , public ActiveDOMObject | 56 , public ActiveDOMObject |
58 , public WebFileWriterClient { | 57 , public WebFileWriterClient { |
59 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(FileWriterBase); | 58 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(FileWriterBase); |
60 DEFINE_WRAPPERTYPEINFO(); | 59 DEFINE_WRAPPERTYPEINFO(); |
61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileWriter); | 60 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileWriter); |
62 public: | 61 public: |
63 static FileWriter* create(ExecutionContext*); | 62 static FileWriter* create(ExecutionContext*); |
| 63 virtual ~FileWriter(); |
64 | 64 |
65 enum ReadyState { | 65 enum ReadyState { |
66 INIT = 0, | 66 INIT = 0, |
67 WRITING = 1, | 67 WRITING = 1, |
68 DONE = 2 | 68 DONE = 2 |
69 }; | 69 }; |
70 | 70 |
71 void write(Blob*, ExceptionState&); | 71 void write(Blob*, ExceptionState&); |
72 void seek(long long position, ExceptionState&); | 72 void seek(long long position, ExceptionState&); |
73 void truncate(long long length, ExceptionState&); | 73 void truncate(long long length, ExceptionState&); |
(...skipping 24 matching lines...) Expand all Loading... |
98 DECLARE_VIRTUAL_TRACE(); | 98 DECLARE_VIRTUAL_TRACE(); |
99 | 99 |
100 private: | 100 private: |
101 enum Operation { | 101 enum Operation { |
102 OperationNone, | 102 OperationNone, |
103 OperationWrite, | 103 OperationWrite, |
104 OperationTruncate, | 104 OperationTruncate, |
105 OperationAbort | 105 OperationAbort |
106 }; | 106 }; |
107 | 107 |
108 FileWriter(ExecutionContext*); | 108 explicit FileWriter(ExecutionContext*); |
109 | |
110 virtual ~FileWriter(); | |
111 | 109 |
112 void completeAbort(); | 110 void completeAbort(); |
113 | 111 |
114 void doOperation(Operation); | 112 void doOperation(Operation); |
115 | 113 |
116 void signalCompletion(FileError::ErrorCode); | 114 void signalCompletion(FileError::ErrorCode); |
117 | 115 |
118 void fireEvent(const AtomicString& type); | 116 void fireEvent(const AtomicString& type); |
119 | 117 |
120 void setError(FileError::ErrorCode, ExceptionState&); | 118 void setError(FileError::ErrorCode, ExceptionState&); |
121 | 119 |
122 Member<FileError> m_error; | 120 Member<FileError> m_error; |
123 ReadyState m_readyState; | 121 ReadyState m_readyState; |
124 Operation m_operationInProgress; | 122 Operation m_operationInProgress; |
125 Operation m_queuedOperation; | 123 Operation m_queuedOperation; |
126 long long m_bytesWritten; | 124 long long m_bytesWritten; |
127 long long m_bytesToWrite; | 125 long long m_bytesToWrite; |
128 long long m_truncateLength; | 126 long long m_truncateLength; |
129 long long m_numAborts; | 127 long long m_numAborts; |
130 long long m_recursionDepth; | 128 long long m_recursionDepth; |
131 double m_lastProgressNotificationTimeMS; | 129 double m_lastProgressNotificationTimeMS; |
132 Member<Blob> m_blobBeingWritten; | 130 Member<Blob> m_blobBeingWritten; |
133 int m_asyncOperationId; | 131 int m_asyncOperationId; |
134 }; | 132 }; |
135 | 133 |
136 } // namespace blink | 134 } // namespace blink |
137 | 135 |
138 #endif // FileWriter_h | 136 #endif // FileWriter_h |
OLD | NEW |