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_WEBFILESYSTEM_IMPL_H_ | 5 #ifndef CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_ |
6 #define CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_ | 6 #define CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
| 14 #include "content/child/worker_task_runner.h" |
14 #include "third_party/WebKit/public/platform/WebFileSystem.h" | 15 #include "third_party/WebKit/public/platform/WebFileSystem.h" |
15 #include "webkit/child/worker_task_runner.h" | |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class MessageLoopProxy; | 18 class MessageLoopProxy; |
19 } | 19 } |
20 | 20 |
21 namespace blink { | 21 namespace blink { |
22 class WebURL; | 22 class WebURL; |
23 class WebFileWriter; | 23 class WebFileWriter; |
24 class WebFileWriterClient; | 24 class WebFileWriterClient; |
25 } | 25 } |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 | 28 |
29 class WebFileSystemImpl | 29 class WebFileSystemImpl : public blink::WebFileSystem, |
30 : public blink::WebFileSystem, | 30 public WorkerTaskRunner::Observer, |
31 public webkit_glue::WorkerTaskRunner::Observer, | 31 public base::NonThreadSafe { |
32 public base::NonThreadSafe { | |
33 public: | 32 public: |
34 // Returns thread-specific instance. If non-null |main_thread_loop| | 33 // Returns thread-specific instance. If non-null |main_thread_loop| |
35 // is given and no thread-specific instance has been created it may | 34 // is given and no thread-specific instance has been created it may |
36 // create a new instance. | 35 // create a new instance. |
37 static WebFileSystemImpl* ThreadSpecificInstance( | 36 static WebFileSystemImpl* ThreadSpecificInstance( |
38 base::MessageLoopProxy* main_thread_loop); | 37 base::MessageLoopProxy* main_thread_loop); |
39 | 38 |
40 // Deletes thread-specific instance (if exists). For workers it deletes | 39 // Deletes thread-specific instance (if exists). For workers it deletes |
41 // itself in OnWorkerRunLoopStopped(), but for an instance created on the | 40 // itself in OnWorkerRunLoopStopped(), but for an instance created on the |
42 // main thread this method must be called. | 41 // main thread this method must be called. |
43 static void DeleteThreadSpecificInstance(); | 42 static void DeleteThreadSpecificInstance(); |
44 | 43 |
45 explicit WebFileSystemImpl(base::MessageLoopProxy* main_thread_loop); | 44 explicit WebFileSystemImpl(base::MessageLoopProxy* main_thread_loop); |
46 virtual ~WebFileSystemImpl(); | 45 virtual ~WebFileSystemImpl(); |
47 | 46 |
48 // webkit_glue::WorkerTaskRunner::Observer implementation. | 47 // WorkerTaskRunner::Observer implementation. |
49 virtual void OnWorkerRunLoopStopped() OVERRIDE; | 48 virtual void OnWorkerRunLoopStopped() OVERRIDE; |
50 | 49 |
51 // WebFileSystem implementation. | 50 // WebFileSystem implementation. |
52 virtual void openFileSystem( | 51 virtual void openFileSystem( |
53 const blink::WebURL& storage_partition, | 52 const blink::WebURL& storage_partition, |
54 const blink::WebFileSystemType type, | 53 const blink::WebFileSystemType type, |
55 blink::WebFileSystemCallbacks); | 54 blink::WebFileSystemCallbacks); |
56 virtual void resolveURL( | 55 virtual void resolveURL( |
57 const blink::WebURL& filesystem_url, | 56 const blink::WebURL& filesystem_url, |
58 blink::WebFileSystemCallbacks) OVERRIDE; | 57 blink::WebFileSystemCallbacks) OVERRIDE; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 112 |
114 CallbacksMap callbacks_; | 113 CallbacksMap callbacks_; |
115 int next_callbacks_id_; | 114 int next_callbacks_id_; |
116 | 115 |
117 DISALLOW_COPY_AND_ASSIGN(WebFileSystemImpl); | 116 DISALLOW_COPY_AND_ASSIGN(WebFileSystemImpl); |
118 }; | 117 }; |
119 | 118 |
120 } // namespace content | 119 } // namespace content |
121 | 120 |
122 #endif // CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_ | 121 #endif // CONTENT_CHILD_FILEAPI_WEBFILESYSTEM_IMPL_H_ |
OLD | NEW |