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 30 matching lines...) Expand all Loading... |
41 #include "public/platform/WebFileWriterClient.h" | 41 #include "public/platform/WebFileWriterClient.h" |
42 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
43 #include "wtf/RefPtr.h" | 43 #include "wtf/RefPtr.h" |
44 | 44 |
45 namespace WebCore { | 45 namespace WebCore { |
46 | 46 |
47 class Blob; | 47 class Blob; |
48 class ExceptionState; | 48 class ExceptionState; |
49 class ExecutionContext; | 49 class ExecutionContext; |
50 | 50 |
51 class FileWriter FINAL : public ScriptWrappable, public FileWriterBase, public A
ctiveDOMObject, public EventTargetWithInlineData, public blink::WebFileWriterCli
ent { | 51 class FileWriter FINAL : public FileWriterBase, public ScriptWrappable, public A
ctiveDOMObject, public EventTargetWithInlineData, public blink::WebFileWriterCli
ent { |
52 DEFINE_EVENT_TARGET_REFCOUNTING(FileWriterBase); | 52 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<F
ileWriterBase>); |
53 public: | 53 public: |
54 static PassRefPtr<FileWriter> create(ExecutionContext*); | 54 static PassRefPtrWillBeRawPtr<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&); |
(...skipping 13 matching lines...) Expand all Loading... |
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); |
82 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); | 82 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); |
83 DEFINE_ATTRIBUTE_EVENT_LISTENER(write); | 83 DEFINE_ATTRIBUTE_EVENT_LISTENER(write); |
84 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
85 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
86 DEFINE_ATTRIBUTE_EVENT_LISTENER(writeend); | 86 DEFINE_ATTRIBUTE_EVENT_LISTENER(writeend); |
87 | 87 |
| 88 virtual void trace(Visitor*) OVERRIDE; |
| 89 |
88 private: | 90 private: |
89 enum Operation { | 91 enum Operation { |
90 OperationNone, | 92 OperationNone, |
91 OperationWrite, | 93 OperationWrite, |
92 OperationTruncate, | 94 OperationTruncate, |
93 OperationAbort | 95 OperationAbort |
94 }; | 96 }; |
95 | 97 |
96 FileWriter(ExecutionContext*); | 98 FileWriter(ExecutionContext*); |
97 | 99 |
98 virtual ~FileWriter(); | 100 virtual ~FileWriter(); |
99 | 101 |
100 void completeAbort(); | 102 void completeAbort(); |
101 | 103 |
102 void doOperation(Operation); | 104 void doOperation(Operation); |
103 | 105 |
104 void signalCompletion(FileError::ErrorCode); | 106 void signalCompletion(FileError::ErrorCode); |
105 | 107 |
106 void fireEvent(const AtomicString& type); | 108 void fireEvent(const AtomicString& type); |
107 | 109 |
108 void setError(FileError::ErrorCode, ExceptionState&); | 110 void setError(FileError::ErrorCode, ExceptionState&); |
109 | 111 |
110 RefPtrWillBePersistent<FileError> m_error; | 112 RefPtrWillBeMember<FileError> m_error; |
111 ReadyState m_readyState; | 113 ReadyState m_readyState; |
112 Operation m_operationInProgress; | 114 Operation m_operationInProgress; |
113 Operation m_queuedOperation; | 115 Operation m_queuedOperation; |
114 long long m_bytesWritten; | 116 long long m_bytesWritten; |
115 long long m_bytesToWrite; | 117 long long m_bytesToWrite; |
116 long long m_truncateLength; | 118 long long m_truncateLength; |
117 long long m_numAborts; | 119 long long m_numAborts; |
118 long long m_recursionDepth; | 120 long long m_recursionDepth; |
119 double m_lastProgressNotificationTimeMS; | 121 double m_lastProgressNotificationTimeMS; |
120 RefPtrWillBePersistent<Blob> m_blobBeingWritten; | 122 RefPtrWillBeMember<Blob> m_blobBeingWritten; |
121 }; | 123 }; |
122 | 124 |
123 } // namespace WebCore | 125 } // namespace WebCore |
124 | 126 |
125 #endif // FileWriter_h | 127 #endif // FileWriter_h |
OLD | NEW |