| 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 29 matching lines...) Expand all Loading... |
| 40 #include "public/platform/WebFileWriterClient.h" | 40 #include "public/platform/WebFileWriterClient.h" |
| 41 #include "wtf/PassRefPtr.h" | 41 #include "wtf/PassRefPtr.h" |
| 42 #include "wtf/RefPtr.h" | 42 #include "wtf/RefPtr.h" |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 class Blob; | 46 class Blob; |
| 47 class ExceptionState; | 47 class ExceptionState; |
| 48 class ExecutionContext; | 48 class ExecutionContext; |
| 49 | 49 |
| 50 class FileWriter : public ScriptWrappable, public FileWriterBase, public ActiveD
OMObject, public EventTargetWithInlineData, public blink::WebFileWriterClient { | 50 class FileWriter FINAL : public ScriptWrappable, public FileWriterBase, public A
ctiveDOMObject, public EventTargetWithInlineData, public blink::WebFileWriterCli
ent { |
| 51 DEFINE_EVENT_TARGET_REFCOUNTING(FileWriterBase); | 51 DEFINE_EVENT_TARGET_REFCOUNTING(FileWriterBase); |
| 52 public: | 52 public: |
| 53 static PassRefPtr<FileWriter> create(ExecutionContext*); | 53 static PassRefPtr<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(blink::WebFileError) OVERRIDE; |
| 72 | 72 |
| 73 // ActiveDOMObject | 73 // ActiveDOMObject |
| 74 virtual void stop(); | 74 virtual void stop() OVERRIDE; |
| 75 | 75 |
| 76 // EventTarget | 76 // EventTarget |
| 77 virtual const AtomicString& interfaceName() const OVERRIDE; | 77 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 78 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } | 78 virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveD
OMObject::executionContext(); } |
| 79 | 79 |
| 80 DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); | 80 DEFINE_ATTRIBUTE_EVENT_LISTENER(writestart); |
| 81 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); | 81 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); |
| 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(write); | 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(write); |
| 83 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 83 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
| 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 115 long long m_truncateLength; | 115 long long m_truncateLength; |
| 116 long long m_numAborts; | 116 long long m_numAborts; |
| 117 long long m_recursionDepth; | 117 long long m_recursionDepth; |
| 118 double m_lastProgressNotificationTimeMS; | 118 double m_lastProgressNotificationTimeMS; |
| 119 RefPtr<Blob> m_blobBeingWritten; | 119 RefPtr<Blob> m_blobBeingWritten; |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 } // namespace WebCore | 122 } // namespace WebCore |
| 123 | 123 |
| 124 #endif // FileWriter_h | 124 #endif // FileWriter_h |
| OLD | NEW |