| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ | 5 #ifndef CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ |
| 6 #define CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ | 6 #define CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 12 #include "content/child/fileapi/webfilewriter_base.h" | 14 #include "content/child/fileapi/webfilewriter_base.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 // An implementation of WebFileWriter for use in chrome renderers and workers. | 18 // An implementation of WebFileWriter for use in chrome renderers and workers. |
| 17 class WebFileWriterImpl : public WebFileWriterBase, | 19 class WebFileWriterImpl : public WebFileWriterBase, |
| 18 public base::SupportsWeakPtr<WebFileWriterImpl> { | 20 public base::SupportsWeakPtr<WebFileWriterImpl> { |
| 19 public: | 21 public: |
| 20 enum Type { | 22 enum Type { |
| 21 TYPE_SYNC, | 23 TYPE_SYNC, |
| 22 TYPE_ASYNC, | 24 TYPE_ASYNC, |
| 23 }; | 25 }; |
| 24 | 26 |
| 25 WebFileWriterImpl(const GURL& path, | 27 WebFileWriterImpl(const GURL& path, |
| 26 blink::WebFileWriterClient* client, | 28 blink::WebFileWriterClient* client, |
| 27 Type type, | 29 Type type, |
| 28 const scoped_refptr<base::SingleThreadTaskRunner>& | 30 const scoped_refptr<base::SingleThreadTaskRunner>& |
| 29 main_thread_task_runner); | 31 main_thread_task_runner); |
| 30 ~WebFileWriterImpl() override; | 32 ~WebFileWriterImpl() override; |
| 31 | 33 |
| 32 protected: | 34 protected: |
| 33 // WebFileWriterBase overrides | 35 // WebFileWriterBase overrides |
| 34 void DoTruncate(const GURL& path, int64 offset) override; | 36 void DoTruncate(const GURL& path, int64_t offset) override; |
| 35 void DoWrite(const GURL& path, | 37 void DoWrite(const GURL& path, |
| 36 const std::string& blob_id, | 38 const std::string& blob_id, |
| 37 int64 offset) override; | 39 int64_t offset) override; |
| 38 void DoCancel() override; | 40 void DoCancel() override; |
| 39 | 41 |
| 40 private: | 42 private: |
| 41 class WriterBridge; | 43 class WriterBridge; |
| 42 | 44 |
| 43 void RunOnMainThread(const base::Closure& closure); | 45 void RunOnMainThread(const base::Closure& closure); |
| 44 | 46 |
| 45 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 47 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 46 scoped_refptr<WriterBridge> bridge_; | 48 scoped_refptr<WriterBridge> bridge_; |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 } // namespace content | 51 } // namespace content |
| 50 | 52 |
| 51 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ | 53 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ |
| OLD | NEW |