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

Side by Side Diff: webkit/tools/test_shell/simple_appcache_system.h

Issue 6056007: net: Add namespace net to the remaining files under url_request directory. (Closed)
Patch Set: chromeos fixes Created 9 years, 11 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
« no previous file with comments | « webkit/glue/resource_loader_bridge.h ('k') | webkit/tools/test_shell/simple_appcache_system.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 WEBKIT_TOOLS_TEST_SHELL_SIMPLE_APPCACHE_SYSTEM_H_ 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_SIMPLE_APPCACHE_SYSTEM_H_
6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_APPCACHE_SYSTEM_H_ 6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_APPCACHE_SYSTEM_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "webkit/appcache/appcache_backend_impl.h" 11 #include "webkit/appcache/appcache_backend_impl.h"
12 #include "webkit/appcache/appcache_frontend_impl.h" 12 #include "webkit/appcache/appcache_frontend_impl.h"
13 #include "webkit/appcache/appcache_service.h" 13 #include "webkit/appcache/appcache_service.h"
14 #include "webkit/appcache/appcache_thread.h" 14 #include "webkit/appcache/appcache_thread.h"
15 #include "webkit/glue/resource_type.h" 15 #include "webkit/glue/resource_type.h"
16 16
17 namespace WebKit { 17 namespace WebKit {
18 class WebApplicationCacheHost; 18 class WebApplicationCacheHost;
19 class WebApplicationCacheHostClient; 19 class WebApplicationCacheHostClient;
20 } 20 }
21 class SimpleBackendProxy; 21 class SimpleBackendProxy;
22 class SimpleFrontendProxy; 22 class SimpleFrontendProxy;
23 23
24 namespace net { 24 namespace net {
25 class URLRequest; 25 class URLRequest;
26 class URLRequestContext;
26 } // namespace net 27 } // namespace net
27 28
28 class URLRequestContext;
29
30 // A class that composes the constituent parts of an appcache system 29 // A class that composes the constituent parts of an appcache system
31 // together for use in a single process with two relavant threads, 30 // together for use in a single process with two relavant threads,
32 // a UI thread on which webkit runs and an IO thread on which URLRequests 31 // a UI thread on which webkit runs and an IO thread on which URLRequests
33 // are handled. This class conspires with SimpleResourceLoaderBridge to 32 // are handled. This class conspires with SimpleResourceLoaderBridge to
34 // retrieve resources from the appcache. 33 // retrieve resources from the appcache.
35 class SimpleAppCacheSystem { 34 class SimpleAppCacheSystem {
36 public: 35 public:
37 // Should be instanced somewhere in main(). If not instanced, the public 36 // Should be instanced somewhere in main(). If not instanced, the public
38 // static methods are all safe no-ops. 37 // static methods are all safe no-ops.
39 SimpleAppCacheSystem(); 38 SimpleAppCacheSystem();
40 virtual ~SimpleAppCacheSystem(); 39 virtual ~SimpleAppCacheSystem();
41 40
42 // One-time main UI thread initialization. 41 // One-time main UI thread initialization.
43 static void InitializeOnUIThread(const FilePath& cache_directory) { 42 static void InitializeOnUIThread(const FilePath& cache_directory) {
44 if (instance_) 43 if (instance_)
45 instance_->InitOnUIThread(cache_directory); 44 instance_->InitOnUIThread(cache_directory);
46 } 45 }
47 46
48 // Called by SimpleResourceLoaderBridge's IOThread class. 47 // Called by SimpleResourceLoaderBridge's IOThread class.
49 // Per IO thread initialization. Only one IO thread can exist 48 // Per IO thread initialization. Only one IO thread can exist
50 // at a time, but after IO thread termination a new one can be 49 // at a time, but after IO thread termination a new one can be
51 // started on which this method should be called. The instance 50 // started on which this method should be called. The instance
52 // is assumed to outlive the IO thread. 51 // is assumed to outlive the IO thread.
53 static void InitializeOnIOThread(URLRequestContext* request_context) { 52 static void InitializeOnIOThread(net::URLRequestContext* request_context) {
54 if (instance_) 53 if (instance_)
55 instance_->InitOnIOThread(request_context); 54 instance_->InitOnIOThread(request_context);
56 } 55 }
57 56
58 static void CleanupOnIOThread() { 57 static void CleanupOnIOThread() {
59 if (instance_) 58 if (instance_)
60 instance_->CleanupIOThread(); 59 instance_->CleanupIOThread();
61 } 60 }
62 61
63 // Called by TestShellWebKitInit to manufacture a 'host' for webcore. 62 // Called by TestShellWebKitInit to manufacture a 'host' for webcore.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return instance_ ? instance_->thread_provider_ : NULL; 108 return instance_ ? instance_->thread_provider_ : NULL;
110 } 109 }
111 110
112 private: 111 private:
113 friend class SimpleBackendProxy; 112 friend class SimpleBackendProxy;
114 friend class SimpleFrontendProxy; 113 friend class SimpleFrontendProxy;
115 friend class appcache::AppCacheThread; 114 friend class appcache::AppCacheThread;
116 115
117 // Instance methods called by our static public methods 116 // Instance methods called by our static public methods
118 void InitOnUIThread(const FilePath& cache_directory); 117 void InitOnUIThread(const FilePath& cache_directory);
119 void InitOnIOThread(URLRequestContext* request_context); 118 void InitOnIOThread(net::URLRequestContext* request_context);
120 void CleanupIOThread(); 119 void CleanupIOThread();
121 WebKit::WebApplicationCacheHost* CreateCacheHostForWebKit( 120 WebKit::WebApplicationCacheHost* CreateCacheHostForWebKit(
122 WebKit::WebApplicationCacheHostClient* client); 121 WebKit::WebApplicationCacheHostClient* client);
123 void SetExtraRequestBits(net::URLRequest* request, 122 void SetExtraRequestBits(net::URLRequest* request,
124 int host_id, 123 int host_id,
125 ResourceType::Type resource_type); 124 ResourceType::Type resource_type);
126 void GetExtraResponseBits(net::URLRequest* request, 125 void GetExtraResponseBits(net::URLRequest* request,
127 int64* cache_id, 126 int64* cache_id,
128 GURL* manifest_url); 127 GURL* manifest_url);
129 128
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 base::Thread db_thread_; 165 base::Thread db_thread_;
167 166
168 // Some unittests create there own IO and DB threads. 167 // Some unittests create there own IO and DB threads.
169 ThreadProvider* thread_provider_; 168 ThreadProvider* thread_provider_;
170 169
171 // A low-tech singleton. 170 // A low-tech singleton.
172 static SimpleAppCacheSystem* instance_; 171 static SimpleAppCacheSystem* instance_;
173 }; 172 };
174 173
175 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_APPCACHE_SYSTEM_H_ 174 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_APPCACHE_SYSTEM_H_
OLDNEW
« no previous file with comments | « webkit/glue/resource_loader_bridge.h ('k') | webkit/tools/test_shell/simple_appcache_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698