| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class ExecutionContext; | 49 class ExecutionContext; |
| 50 class StringOrArrayBuffer; | 50 class StringOrArrayBuffer; |
| 51 | 51 |
| 52 class CORE_EXPORT FileReader final : public RefCountedGarbageCollectedEventTarge
tWithInlineData<FileReader>, public ActiveDOMObject, public FileReaderLoaderClie
nt { | 52 class CORE_EXPORT FileReader final : public RefCountedGarbageCollectedEventTarge
tWithInlineData<FileReader>, public ActiveDOMObject, public FileReaderLoaderClie
nt { |
| 53 DEFINE_WRAPPERTYPEINFO(); | 53 DEFINE_WRAPPERTYPEINFO(); |
| 54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(FileReader); | 54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(FileReader); |
| 55 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileReader); | 55 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileReader); |
| 56 public: | 56 public: |
| 57 static FileReader* create(ExecutionContext*); | 57 static FileReader* create(ExecutionContext*); |
| 58 | 58 |
| 59 virtual ~FileReader(); | 59 ~FileReader() override; |
| 60 | 60 |
| 61 enum ReadyState { | 61 enum ReadyState { |
| 62 EMPTY = 0, | 62 EMPTY = 0, |
| 63 LOADING = 1, | 63 LOADING = 1, |
| 64 DONE = 2 | 64 DONE = 2 |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 void readAsArrayBuffer(Blob*, ExceptionState&); | 67 void readAsArrayBuffer(Blob*, ExceptionState&); |
| 68 void readAsBinaryString(Blob*, ExceptionState&); | 68 void readAsBinaryString(Blob*, ExceptionState&); |
| 69 void readAsText(Blob*, const String& encoding, ExceptionState&); | 69 void readAsText(Blob*, const String& encoding, ExceptionState&); |
| 70 void readAsText(Blob*, ExceptionState&); | 70 void readAsText(Blob*, ExceptionState&); |
| 71 void readAsDataURL(Blob*, ExceptionState&); | 71 void readAsDataURL(Blob*, ExceptionState&); |
| 72 void abort(); | 72 void abort(); |
| 73 | 73 |
| 74 void doAbort(); | 74 void doAbort(); |
| 75 | 75 |
| 76 ReadyState readyState() const { return m_state; } | 76 ReadyState readyState() const { return m_state; } |
| 77 FileError* error() { return m_error; } | 77 FileError* error() { return m_error; } |
| 78 void result(StringOrArrayBuffer& resultAttribute) const; | 78 void result(StringOrArrayBuffer& resultAttribute) const; |
| 79 | 79 |
| 80 // ActiveDOMObject | 80 // ActiveDOMObject |
| 81 virtual void stop() override; | 81 void stop() override; |
| 82 virtual bool hasPendingActivity() const override; | 82 bool hasPendingActivity() const override; |
| 83 | 83 |
| 84 // EventTarget | 84 // EventTarget |
| 85 virtual const AtomicString& interfaceName() const override; | 85 const AtomicString& interfaceName() const override; |
| 86 virtual ExecutionContext* executionContext() const override { return ActiveD
OMObject::executionContext(); } | 86 ExecutionContext* executionContext() const override { return ActiveDOMObject
::executionContext(); } |
| 87 | 87 |
| 88 // FileReaderLoaderClient | 88 // FileReaderLoaderClient |
| 89 virtual void didStartLoading() override; | 89 void didStartLoading() override; |
| 90 virtual void didReceiveData() override; | 90 void didReceiveData() override; |
| 91 virtual void didFinishLoading() override; | 91 void didFinishLoading() override; |
| 92 virtual void didFail(FileError::ErrorCode) override; | 92 void didFail(FileError::ErrorCode) override; |
| 93 | 93 |
| 94 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); | 94 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); |
| 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); | 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); |
| 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(load); | 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(load); |
| 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
| 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend); | 99 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend); |
| 100 | 100 |
| 101 DECLARE_VIRTUAL_TRACE(); | 101 DECLARE_VIRTUAL_TRACE(); |
| 102 | 102 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 130 | 130 |
| 131 OwnPtr<FileReaderLoader> m_loader; | 131 OwnPtr<FileReaderLoader> m_loader; |
| 132 Member<FileError> m_error; | 132 Member<FileError> m_error; |
| 133 double m_lastProgressNotificationTimeMS; | 133 double m_lastProgressNotificationTimeMS; |
| 134 int m_asyncOperationId; | 134 int m_asyncOperationId; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 } // namespace blink | 137 } // namespace blink |
| 138 | 138 |
| 139 #endif // FileReader_h | 139 #endif // FileReader_h |
| OLD | NEW |