Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: content/child/fileapi/webfilewriter_impl.h

Issue 22363002: 2nd try: Support synchronous mode in WebFileWriterImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
11 #include "webkit/renderer/fileapi/webfilewriter_base.h" 11 #include "webkit/renderer/fileapi/webfilewriter_base.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 // An implementation of WebFileWriter for use in chrome renderers and workers. 15 // An implementation of WebFileWriter for use in chrome renderers and workers.
16 class WebFileWriterImpl : public fileapi::WebFileWriterBase, 16 class WebFileWriterImpl : public fileapi::WebFileWriterBase,
17 public base::SupportsWeakPtr<WebFileWriterImpl> { 17 public base::SupportsWeakPtr<WebFileWriterImpl> {
18 public: 18 public:
19 enum Type {
20 TYPE_SYNC,
21 TYPE_ASYNC,
22 };
23
19 WebFileWriterImpl(const GURL& path, 24 WebFileWriterImpl(const GURL& path,
20 WebKit::WebFileWriterClient* client, 25 WebKit::WebFileWriterClient* client,
26 Type type,
21 base::MessageLoopProxy* main_thread_loop); 27 base::MessageLoopProxy* main_thread_loop);
22 virtual ~WebFileWriterImpl(); 28 virtual ~WebFileWriterImpl();
23 29
24 protected: 30 protected:
25 // WebFileWriterBase overrides 31 // WebFileWriterBase overrides
26 virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE; 32 virtual void DoTruncate(const GURL& path, int64 offset) OVERRIDE;
27 virtual void DoWrite(const GURL& path, const GURL& blob_url, 33 virtual void DoWrite(const GURL& path, const GURL& blob_url,
28 int64 offset) OVERRIDE; 34 int64 offset) OVERRIDE;
29 virtual void DoCancel() OVERRIDE; 35 virtual void DoCancel() OVERRIDE;
30 36
31 private: 37 private:
32 class WriterBridge; 38 class WriterBridge;
33 39
34 void RunOnMainThread(const base::Closure& closure); 40 void RunOnMainThread(const base::Closure& closure);
35 41
36 scoped_refptr<base::MessageLoopProxy> main_thread_loop_; 42 scoped_refptr<base::MessageLoopProxy> main_thread_loop_;
37 scoped_refptr<WriterBridge> bridge_; 43 scoped_refptr<WriterBridge> bridge_;
38 }; 44 };
39 45
40 } // namespace content 46 } // namespace content
41 47
42 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_ 48 #endif // CONTENT_CHILD_FILEAPI_WEBFILEWRITER_IMPL_H_
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilesystem_impl.cc ('k') | content/child/fileapi/webfilewriter_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698