| 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> |
| 34 | 35 |
| 35 namespace blink { | 36 namespace blink { |
| 36 | 37 |
| 37 Resource* RawResource::fetchSynchronously(FetchRequest& request, ResourceFetcher
* fetcher) | 38 Resource* RawResource::fetchSynchronously(FetchRequest& request, ResourceFetcher
* fetcher) |
| 38 { | 39 { |
| 39 request.mutableResourceRequest().setTimeoutInterval(10); | 40 request.mutableResourceRequest().setTimeoutInterval(10); |
| 40 ResourceLoaderOptions options(request.options()); | 41 ResourceLoaderOptions options(request.options()); |
| 41 options.synchronousPolicy = RequestSynchronously; | 42 options.synchronousPolicy = RequestSynchronously; |
| 42 request.setOptions(options); | 43 request.setOptions(options); |
| 43 return fetcher->requestResource(request, RawResourceFactory(Resource::Raw)); | 44 return fetcher->requestResource(request, RawResourceFactory(Resource::Raw)); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 c->redirectReceived(this, newRequest, redirectResponse); | 136 c->redirectReceived(this, newRequest, redirectResponse); |
| 136 } | 137 } |
| 137 | 138 |
| 138 void RawResource::willNotFollowRedirect() | 139 void RawResource::willNotFollowRedirect() |
| 139 { | 140 { |
| 140 ResourceClientWalker<RawResourceClient> w(m_clients); | 141 ResourceClientWalker<RawResourceClient> w(m_clients); |
| 141 while (RawResourceClient* c = w.next()) | 142 while (RawResourceClient* c = w.next()) |
| 142 c->redirectBlocked(); | 143 c->redirectBlocked(); |
| 143 } | 144 } |
| 144 | 145 |
| 145 void RawResource::responseReceived(const ResourceResponse& response, PassOwnPtr<
WebDataConsumerHandle> handle) | 146 void RawResource::responseReceived(const ResourceResponse& response, std::unique
_ptr<WebDataConsumerHandle> handle) |
| 146 { | 147 { |
| 147 bool isSuccessfulRevalidation = isCacheValidator() && response.httpStatusCod
e() == 304; | 148 bool isSuccessfulRevalidation = isCacheValidator() && response.httpStatusCod
e() == 304; |
| 148 Resource::responseReceived(response, nullptr); | 149 Resource::responseReceived(response, nullptr); |
| 149 | 150 |
| 150 ResourceClientWalker<RawResourceClient> w(m_clients); | 151 ResourceClientWalker<RawResourceClient> w(m_clients); |
| 151 ASSERT(count() <= 1 || !handle); | 152 ASSERT(count() <= 1 || !handle); |
| 152 while (RawResourceClient* c = w.next()) { | 153 while (RawResourceClient* c = w.next()) { |
| 153 // |handle| is cleared when passed, but it's not a problem because | 154 // |handle| is cleared when passed, but it's not a problem because |
| 154 // |handle| is null when there are two or more clients, as asserted. | 155 // |handle| is null when there are two or more clients, as asserted. |
| 155 c->responseReceived(this, m_response, std::move(handle)); | 156 c->responseReceived(this, m_response, std::move(handle)); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 for (const auto& header : oldHeaders) { | 259 for (const auto& header : oldHeaders) { |
| 259 AtomicString headerName = header.key; | 260 AtomicString headerName = header.key; |
| 260 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH
eaders.get(headerName)) | 261 if (!shouldIgnoreHeaderForCacheReuse(headerName) && header.value != newH
eaders.get(headerName)) |
| 261 return false; | 262 return false; |
| 262 } | 263 } |
| 263 | 264 |
| 264 return true; | 265 return true; |
| 265 } | 266 } |
| 266 | 267 |
| 267 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |