OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/appcache/appcache_interceptor.h" | 5 #include "content/browser/appcache/appcache_interceptor.h" |
6 | 6 |
7 #include "base/profiler/scoped_tracker.h" | |
8 #include "content/browser/appcache/appcache_backend_impl.h" | 7 #include "content/browser/appcache/appcache_backend_impl.h" |
9 #include "content/browser/appcache/appcache_host.h" | 8 #include "content/browser/appcache/appcache_host.h" |
10 #include "content/browser/appcache/appcache_request_handler.h" | 9 #include "content/browser/appcache/appcache_request_handler.h" |
11 #include "content/browser/appcache/appcache_service_impl.h" | 10 #include "content/browser/appcache/appcache_service_impl.h" |
12 #include "content/browser/appcache/appcache_url_request_job.h" | 11 #include "content/browser/appcache/appcache_url_request_job.h" |
13 #include "content/common/appcache_interfaces.h" | 12 #include "content/common/appcache_interfaces.h" |
14 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
15 | 14 |
16 static int kHandlerKey; // Value is not used. | 15 static int kHandlerKey; // Value is not used. |
17 | 16 |
(...skipping 10 matching lines...) Expand all Loading... |
28 request->GetUserData(&kHandlerKey)); | 27 request->GetUserData(&kHandlerKey)); |
29 } | 28 } |
30 | 29 |
31 void AppCacheInterceptor::SetExtraRequestInfo( | 30 void AppCacheInterceptor::SetExtraRequestInfo( |
32 net::URLRequest* request, | 31 net::URLRequest* request, |
33 AppCacheServiceImpl* service, | 32 AppCacheServiceImpl* service, |
34 int process_id, | 33 int process_id, |
35 int host_id, | 34 int host_id, |
36 ResourceType resource_type, | 35 ResourceType resource_type, |
37 bool should_reset_appcache) { | 36 bool should_reset_appcache) { |
38 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456331 is fixed. | |
39 tracked_objects::ScopedTracker tracking_profile( | |
40 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
41 "456331 AppCacheInterceptor::SetExtraRequestInfo")); | |
42 if (!service || (host_id == kAppCacheNoHostId)) | 37 if (!service || (host_id == kAppCacheNoHostId)) |
43 return; | 38 return; |
44 | 39 |
45 AppCacheBackendImpl* backend = service->GetBackend(process_id); | 40 AppCacheBackendImpl* backend = service->GetBackend(process_id); |
46 if (!backend) | 41 if (!backend) |
47 return; | 42 return; |
48 | 43 |
49 // TODO(michaeln): An invalid host id is indicative of bad data | 44 // TODO(michaeln): An invalid host id is indicative of bad data |
50 // from a child process. How should we handle that here? | 45 // from a child process. How should we handle that here? |
51 AppCacheHost* host = backend->GetHost(host_id); | 46 AppCacheHost* host = backend->GetHost(host_id); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 121 |
127 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( | 122 net::URLRequestJob* AppCacheInterceptor::MaybeInterceptResponse( |
128 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { | 123 net::URLRequest* request, net::NetworkDelegate* network_delegate) const { |
129 AppCacheRequestHandler* handler = GetHandler(request); | 124 AppCacheRequestHandler* handler = GetHandler(request); |
130 if (!handler) | 125 if (!handler) |
131 return NULL; | 126 return NULL; |
132 return handler->MaybeLoadFallbackForResponse(request, network_delegate); | 127 return handler->MaybeLoadFallbackForResponse(request, network_delegate); |
133 } | 128 } |
134 | 129 |
135 } // namespace content | 130 } // namespace content |
OLD | NEW |