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

Side by Side Diff: webkit/appcache/appcache_request_handler.h

Issue 8343018: More groundwork for flat file based response storage. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « webkit/appcache/appcache_interfaces.cc ('k') | webkit/appcache/appcache_request_handler.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) 2011 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_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ 5 #ifndef WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
6 #define WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ 6 #define WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "net/url_request/url_request.h" 9 #include "net/url_request/url_request.h"
10 #include "webkit/appcache/appcache_entry.h" 10 #include "webkit/appcache/appcache_entry.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 ResourceType::IsSharedWorker(type); 46 ResourceType::IsSharedWorker(type);
47 } 47 }
48 48
49 private: 49 private:
50 friend class AppCacheHost; 50 friend class AppCacheHost;
51 51
52 // Callers should use AppCacheHost::CreateRequestHandler. 52 // Callers should use AppCacheHost::CreateRequestHandler.
53 AppCacheRequestHandler(AppCacheHost* host, ResourceType::Type resource_type); 53 AppCacheRequestHandler(AppCacheHost* host, ResourceType::Type resource_type);
54 54
55 // AppCacheHost::Observer override 55 // AppCacheHost::Observer override
56 virtual void OnDestructionImminent(AppCacheHost* host); 56 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE;
57 57
58 // Helpers to instruct a waiting job with what response to 58 // Helpers to instruct a waiting job with what response to
59 // deliver for the request we're handling. 59 // deliver for the request we're handling.
60 void DeliverAppCachedResponse(const AppCacheEntry& entry, int64 cache_id, 60 void DeliverAppCachedResponse(const AppCacheEntry& entry, int64 cache_id,
61 const GURL& manifest_url, bool is_fallback, 61 int64 group_id, const GURL& manifest_url,
62 const GURL& fallback_url); 62 bool is_fallback, const GURL& fallback_url);
63 void DeliverNetworkResponse(); 63 void DeliverNetworkResponse();
64 void DeliverErrorResponse(); 64 void DeliverErrorResponse();
65 65
66 // Helper to retrieve a pointer to the storage object. 66 // Helper to retrieve a pointer to the storage object.
67 AppCacheStorage* storage() const; 67 AppCacheStorage* storage() const;
68 68
69 bool is_main_resource() const { 69 bool is_main_resource() const {
70 return IsMainResourceType(resource_type_); 70 return IsMainResourceType(resource_type_);
71 } 71 }
72 72
73 // Main-resource loading ------------------------------------- 73 // Main-resource loading -------------------------------------
74 // Frame and SharedWorker main resources are handled here. 74 // Frame and SharedWorker main resources are handled here.
75 75
76 void MaybeLoadMainResource(net::URLRequest* request); 76 void MaybeLoadMainResource(net::URLRequest* request);
77 77
78 // AppCacheStorage::Delegate methods 78 // AppCacheStorage::Delegate methods
79 virtual void OnMainResponseFound( 79 virtual void OnMainResponseFound(
80 const GURL& url, const AppCacheEntry& entry, 80 const GURL& url, const AppCacheEntry& entry,
81 const GURL& fallback_url, const AppCacheEntry& fallback_entry, 81 const GURL& fallback_url, const AppCacheEntry& fallback_entry,
82 int64 cache_id, const GURL& mainfest_url); 82 int64 cache_id, int64 group_id, const GURL& mainfest_url) OVERRIDE;
83 83
84 // Sub-resource loading ------------------------------------- 84 // Sub-resource loading -------------------------------------
85 // Dedicated worker and all manner of sub-resources are handled here. 85 // Dedicated worker and all manner of sub-resources are handled here.
86 86
87 void MaybeLoadSubResource(net::URLRequest* request); 87 void MaybeLoadSubResource(net::URLRequest* request);
88 void ContinueMaybeLoadSubResource(); 88 void ContinueMaybeLoadSubResource();
89 89
90 // AppCacheHost::Observer override 90 // AppCacheHost::Observer override
91 virtual void OnCacheSelectionComplete(AppCacheHost* host); 91 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE;
92 92
93 // Data members ----------------------------------------------- 93 // Data members -----------------------------------------------
94 94
95 // What host we're servicing a request for. 95 // What host we're servicing a request for.
96 AppCacheHost* host_; 96 AppCacheHost* host_;
97 97
98 // Frame vs subresource vs sharedworker loads are somewhat different. 98 // Frame vs subresource vs sharedworker loads are somewhat different.
99 ResourceType::Type resource_type_; 99 ResourceType::Type resource_type_;
100 100
101 // Subresource requests wait until after cache selection completes. 101 // Subresource requests wait until after cache selection completes.
102 bool is_waiting_for_cache_selection_; 102 bool is_waiting_for_cache_selection_;
103 103
104 // Info about the type of response we found for delivery. 104 // Info about the type of response we found for delivery.
105 // These are relevant for both main and subresource requests. 105 // These are relevant for both main and subresource requests.
106 int64 found_group_id_;
106 int64 found_cache_id_; 107 int64 found_cache_id_;
107 AppCacheEntry found_entry_; 108 AppCacheEntry found_entry_;
108 AppCacheEntry found_fallback_entry_; 109 AppCacheEntry found_fallback_entry_;
109 GURL found_fallback_url_; 110 GURL found_fallback_url_;
110 GURL found_manifest_url_; 111 GURL found_manifest_url_;
111 bool found_network_namespace_; 112 bool found_network_namespace_;
112 113
113 // True if a cache entry this handler attempted to return was 114 // True if a cache entry this handler attempted to return was
114 // not found in the disk cache. Once set, the handler will take 115 // not found in the disk cache. Once set, the handler will take
115 // no action on all subsequent intercept opportunities, so the 116 // no action on all subsequent intercept opportunities, so the
116 // request and any redirects will be handled by the network library. 117 // request and any redirects will be handled by the network library.
117 bool cache_entry_not_found_; 118 bool cache_entry_not_found_;
118 119
119 // The job we use to deliver a response. 120 // The job we use to deliver a response.
120 scoped_refptr<AppCacheURLRequestJob> job_; 121 scoped_refptr<AppCacheURLRequestJob> job_;
121 122
122 friend class AppCacheRequestHandlerTest; 123 friend class AppCacheRequestHandlerTest;
123 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler); 124 DISALLOW_COPY_AND_ASSIGN(AppCacheRequestHandler);
124 }; 125 };
125 126
126 } // namespace appcache 127 } // namespace appcache
127 128
128 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_ 129 #endif // WEBKIT_APPCACHE_APPCACHE_REQUEST_HANDLER_H_
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_interfaces.cc ('k') | webkit/appcache/appcache_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698