| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 class BlobDataHandle; | 46 class BlobDataHandle; |
| 47 class DOMArrayBuffer; | 47 class DOMArrayBuffer; |
| 48 class ExecutionContext; | 48 class ExecutionContext; |
| 49 class FileReaderLoaderClient; | 49 class FileReaderLoaderClient; |
| 50 class Stream; | 50 class Stream; |
| 51 class TextResourceDecoder; | 51 class TextResourceDecoder; |
| 52 class ThreadableLoader; | 52 class ThreadableLoader; |
| 53 | 53 |
| 54 class CORE_EXPORT FileReaderLoader final : public ThreadableLoaderClient { | 54 class CORE_EXPORT FileReaderLoader final : public ThreadableLoaderClient { |
| 55 WTF_MAKE_FAST_ALLOCATED(FileReaderLoader); |
| 55 public: | 56 public: |
| 56 enum ReadType { | 57 enum ReadType { |
| 57 ReadAsArrayBuffer, | 58 ReadAsArrayBuffer, |
| 58 ReadAsBinaryString, | 59 ReadAsBinaryString, |
| 59 ReadAsText, | 60 ReadAsText, |
| 60 ReadAsDataURL, | 61 ReadAsDataURL, |
| 61 ReadByClient | 62 ReadByClient |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 // If client is given, do the loading asynchronously. Otherwise, load synchr
onously. | 65 // If client is given, do the loading asynchronously. Otherwise, load synchr
onously. |
| 66 static PassOwnPtr<FileReaderLoader> create(ReadType readType, FileReaderLoad
erClient* client) |
| 67 { |
| 68 return adoptPtr(new FileReaderLoader(readType, client)); |
| 69 } |
| 70 |
| 65 FileReaderLoader(ReadType, FileReaderLoaderClient*); | 71 FileReaderLoader(ReadType, FileReaderLoaderClient*); |
| 66 virtual ~FileReaderLoader(); | 72 virtual ~FileReaderLoader(); |
| 67 | 73 |
| 68 void start(ExecutionContext*, PassRefPtr<BlobDataHandle>); | 74 void start(ExecutionContext*, PassRefPtr<BlobDataHandle>); |
| 69 void start(ExecutionContext*, const Stream&, unsigned readSize); | 75 void start(ExecutionContext*, const Stream&, unsigned readSize); |
| 70 void cancel(); | 76 void cancel(); |
| 71 | 77 |
| 72 // ThreadableLoaderClient | 78 // ThreadableLoaderClient |
| 73 virtual void didReceiveResponse(unsigned long, const ResourceResponse&, Pass
OwnPtr<WebDataConsumerHandle>) override; | 79 virtual void didReceiveResponse(unsigned long, const ResourceResponse&, Pass
OwnPtr<WebDataConsumerHandle>) override; |
| 74 virtual void didReceiveData(const char*, unsigned) override; | 80 virtual void didReceiveData(const char*, unsigned) override; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 bool m_hasRange; | 144 bool m_hasRange; |
| 139 unsigned m_rangeStart; | 145 unsigned m_rangeStart; |
| 140 unsigned m_rangeEnd; | 146 unsigned m_rangeEnd; |
| 141 | 147 |
| 142 FileError::ErrorCode m_errorCode; | 148 FileError::ErrorCode m_errorCode; |
| 143 }; | 149 }; |
| 144 | 150 |
| 145 } // namespace blink | 151 } // namespace blink |
| 146 | 152 |
| 147 #endif // FileReaderLoader_h | 153 #endif // FileReaderLoader_h |
| OLD | NEW |