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 28 matching lines...) Expand all Loading... |
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" | 41 #include "wtf/RefPtr.h" |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 class Blob; | 45 class Blob; |
46 class ExceptionState; | 46 class ExceptionState; |
47 class ExecutionContext; | 47 class ExecutionContext; |
48 | 48 |
49 class FileWriter FINAL : public FileWriterBase, public ActiveDOMObject, public E
ventTargetWithInlineData, public WebFileWriterClient { | 49 class FileWriter final : public FileWriterBase, public ActiveDOMObject, public E
ventTargetWithInlineData, public WebFileWriterClient { |
50 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<F
ileWriterBase>); | 50 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<F
ileWriterBase>); |
51 DEFINE_WRAPPERTYPEINFO(); | 51 DEFINE_WRAPPERTYPEINFO(); |
52 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileWriter); | 52 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileWriter); |
53 public: | 53 public: |
54 static FileWriter* create(ExecutionContext*); | 54 static FileWriter* create(ExecutionContext*); |
55 | 55 |
56 enum ReadyState { | 56 enum ReadyState { |
57 INIT = 0, | 57 INIT = 0, |
58 WRITING = 1, | 58 WRITING = 1, |
59 DONE = 2 | 59 DONE = 2 |
60 }; | 60 }; |
61 | 61 |
62 void write(Blob*, ExceptionState&); | 62 void write(Blob*, ExceptionState&); |
63 void seek(long long position, ExceptionState&); | 63 void seek(long long position, ExceptionState&); |
64 void truncate(long long length, ExceptionState&); | 64 void truncate(long long length, ExceptionState&); |
65 void abort(ExceptionState&); | 65 void abort(ExceptionState&); |
66 ReadyState readyState() const { return m_readyState; } | 66 ReadyState readyState() const { return m_readyState; } |
67 FileError* error() const { return m_error.get(); } | 67 FileError* error() const { return m_error.get(); } |
68 | 68 |
69 // WebFileWriterClient | 69 // WebFileWriterClient |
70 virtual void didWrite(long long bytes, bool complete) OVERRIDE; | 70 virtual void didWrite(long long bytes, bool complete) override; |
71 virtual void didTruncate() OVERRIDE; | 71 virtual void didTruncate() override; |
72 virtual void didFail(WebFileError) OVERRIDE; | 72 virtual void didFail(WebFileError) override; |
73 | 73 |
74 // ActiveDOMObject | 74 // ActiveDOMObject |
75 virtual void stop() OVERRIDE; | 75 virtual void stop() override; |
76 virtual bool hasPendingActivity() const OVERRIDE; | 76 virtual bool hasPendingActivity() const override; |
77 | 77 |
78 // EventTarget | 78 // EventTarget |
79 virtual const AtomicString& interfaceName() const OVERRIDE; | 79 virtual const AtomicString& interfaceName() const override; |
80 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } | 80 virtual ExecutionContext* executionContext() const override { return ActiveD
OMObject::executionContext(); } |
81 | 81 |
82 DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); | 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); |
83 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); | 83 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); |
84 DEFINE_ATTRIBUTE_EVENT_LISTENER(write); | 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(write); |
85 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
86 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
87 DEFINE_ATTRIBUTE_EVENT_LISTENER(writeend); | 87 DEFINE_ATTRIBUTE_EVENT_LISTENER(writeend); |
88 | 88 |
89 virtual void trace(Visitor*) OVERRIDE; | 89 virtual void trace(Visitor*) override; |
90 | 90 |
91 private: | 91 private: |
92 enum Operation { | 92 enum Operation { |
93 OperationNone, | 93 OperationNone, |
94 OperationWrite, | 94 OperationWrite, |
95 OperationTruncate, | 95 OperationTruncate, |
96 OperationAbort | 96 OperationAbort |
97 }; | 97 }; |
98 | 98 |
99 FileWriter(ExecutionContext*); | 99 FileWriter(ExecutionContext*); |
(...skipping 20 matching lines...) Expand all Loading... |
120 long long m_numAborts; | 120 long long m_numAborts; |
121 long long m_recursionDepth; | 121 long long m_recursionDepth; |
122 double m_lastProgressNotificationTimeMS; | 122 double m_lastProgressNotificationTimeMS; |
123 Member<Blob> m_blobBeingWritten; | 123 Member<Blob> m_blobBeingWritten; |
124 int m_asyncOperationId; | 124 int m_asyncOperationId; |
125 }; | 125 }; |
126 | 126 |
127 } // namespace blink | 127 } // namespace blink |
128 | 128 |
129 #endif // FileWriter_h | 129 #endif // FileWriter_h |
OLD | NEW |