OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #include "core/fetch/RawResource.h" | 26 #include "core/fetch/RawResource.h" |
27 | 27 |
28 #include "core/fetch/FetchRequest.h" | 28 #include "core/fetch/FetchRequest.h" |
29 #include "core/fetch/MemoryCache.h" | 29 #include "core/fetch/MemoryCache.h" |
30 #include "core/fetch/ResourceClientOrObserverWalker.h" | 30 #include "core/fetch/ResourceClientOrObserverWalker.h" |
31 #include "core/fetch/ResourceFetcher.h" | 31 #include "core/fetch/ResourceFetcher.h" |
32 #include "core/fetch/ResourceLoader.h" | 32 #include "core/fetch/ResourceLoader.h" |
33 #include "platform/HTTPNames.h" | 33 #include "platform/HTTPNames.h" |
34 #include <memory> | |
35 | 34 |
36 namespace blink { | 35 namespace blink { |
37 | 36 |
38 Resource* RawResource::fetchSynchronously(FetchRequest& request, ResourceFetcher
* fetcher) | 37 Resource* RawResource::fetchSynchronously(FetchRequest& request, ResourceFetcher
* fetcher) |
39 { | 38 { |
40 request.mutableResourceRequest().setTimeoutInterval(10); | 39 request.mutableResourceRequest().setTimeoutInterval(10); |
41 ResourceLoaderOptions options(request.options()); | 40 ResourceLoaderOptions options(request.options()); |
42 options.synchronousPolicy = RequestSynchronously; | 41 options.synchronousPolicy = RequestSynchronously; |
43 request.setOptions(options); | 42 request.setOptions(options); |
44 return fetcher->requestResource(request, RawResourceFactory(Resource::Raw)); | 43 return fetcher->requestResource(request, RawResourceFactory(Resource::Raw)); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 c->redirectReceived(this, newRequest, redirectResponse); | 135 c->redirectReceived(this, newRequest, redirectResponse); |
137 } | 136 } |
138 | 137 |
139 void RawResource::willNotFollowRedirect() | 138 void RawResource::willNotFollowRedirect() |
140 { | 139 { |
141 ResourceClientWalker<RawResourceClient> w(m_clients); | 140 ResourceClientWalker<RawResourceClient> w(m_clients); |
142 while (RawResourceClient* c = w.next()) | 141 while (RawResourceClient* c = w.next()) |
143 c->redirectBlocked(); | 142 c->redirectBlocked(); |
144 } | 143 } |
145 | 144 |
146 void RawResource::responseReceived(const ResourceResponse& response, std::unique
_ptr<WebDataConsumerHandle> handle) | 145 void RawResource::responseReceived(const ResourceResponse& response, PassOwnPtr<
WebDataConsumerHandle> handle) |
147 { | 146 { |
148 bool isSuccessfulRevalidation = isCacheValidator() && response.httpStatusCod
e() == 304; | 147 bool isSuccessfulRevalidation = isCacheValidator() && response.httpStatusCod
e() == 304; |
149 Resource::responseReceived(response, nullptr); | 148 Resource::responseReceived(response, nullptr); |
150 | 149 |
151 ResourceClientWalker<RawResourceClient> w(m_clients); | 150 ResourceClientWalker<RawResourceClient> w(m_clients); |
152 ASSERT(count() <= 1 || !handle); | 151 ASSERT(count() <= 1 || !handle); |
153 while (RawResourceClient* c = w.next()) { | 152 while (RawResourceClient* c = w.next()) { |
154 // |handle| is cleared when passed, but it's not a problem because | 153 // |handle| is cleared when passed, but it's not a problem because |
155 // |handle| is null when there are two or more clients, as asserted. | 154 // |handle| is null when there are two or more clients, as asserted. |
156 c->responseReceived(this, m_response, std::move(handle)); | 155 c->responseReceived(this, m_response, std::move(handle)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 for (const auto& header : oldHeaders) { | 258 for (const auto& header : oldHeaders) { |
260 AtomicString headerName = header.key; | 259 AtomicString headerName = header.key; |
261 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH
eaders.get(headerName)) | 260 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH
eaders.get(headerName)) |
262 return false; | 261 return false; |
263 } | 262 } |
264 | 263 |
265 return true; | 264 return true; |
266 } | 265 } |
267 | 266 |
268 } // namespace blink | 267 } // namespace blink |
OLD | NEW |