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 blink::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 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileWriter); | 51 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileWriter); |
52 public: | 52 public: |
53 static FileWriter* create(ExecutionContext*); | 53 static FileWriter* create(ExecutionContext*); |
54 | 54 |
55 enum ReadyState { | 55 enum ReadyState { |
56 INIT = 0, | 56 INIT = 0, |
57 WRITING = 1, | 57 WRITING = 1, |
58 DONE = 2 | 58 DONE = 2 |
59 }; | 59 }; |
60 | 60 |
61 void write(Blob*, ExceptionState&); | 61 void write(Blob*, ExceptionState&); |
62 void seek(long long position, ExceptionState&); | 62 void seek(long long position, ExceptionState&); |
63 void truncate(long long length, ExceptionState&); | 63 void truncate(long long length, ExceptionState&); |
64 void abort(ExceptionState&); | 64 void abort(ExceptionState&); |
65 ReadyState readyState() const { return m_readyState; } | 65 ReadyState readyState() const { return m_readyState; } |
66 FileError* error() const { return m_error.get(); } | 66 FileError* error() const { return m_error.get(); } |
67 | 67 |
68 // WebFileWriterClient | 68 // WebFileWriterClient |
69 virtual void didWrite(long long bytes, bool complete) OVERRIDE; | 69 virtual void didWrite(long long bytes, bool complete) OVERRIDE; |
70 virtual void didTruncate() OVERRIDE; | 70 virtual void didTruncate() OVERRIDE; |
71 virtual void didFail(blink::WebFileError) OVERRIDE; | 71 virtual void didFail(WebFileError) OVERRIDE; |
72 | 72 |
73 // ActiveDOMObject | 73 // ActiveDOMObject |
74 virtual void stop() OVERRIDE; | 74 virtual void stop() OVERRIDE; |
75 virtual bool hasPendingActivity() const OVERRIDE; | 75 virtual bool hasPendingActivity() const OVERRIDE; |
76 | 76 |
77 // EventTarget | 77 // EventTarget |
78 virtual const AtomicString& interfaceName() const OVERRIDE; | 78 virtual const AtomicString& interfaceName() const OVERRIDE; |
79 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } | 79 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } |
80 | 80 |
81 DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); | 81 DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 long long m_numAborts; | 119 long long m_numAborts; |
120 long long m_recursionDepth; | 120 long long m_recursionDepth; |
121 double m_lastProgressNotificationTimeMS; | 121 double m_lastProgressNotificationTimeMS; |
122 RefPtrWillBeMember<Blob> m_blobBeingWritten; | 122 RefPtrWillBeMember<Blob> m_blobBeingWritten; |
123 int m_asyncOperationId; | 123 int m_asyncOperationId; |
124 }; | 124 }; |
125 | 125 |
126 } // namespace blink | 126 } // namespace blink |
127 | 127 |
128 #endif // FileWriter_h | 128 #endif // FileWriter_h |
OLD | NEW |