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

Unified Diff: third_party/WebKit/Source/core/fetch/RawResource.cpp

Issue 2637063002: Use MockResource as much as possibler in MemoryCacheCorrectnessTest (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/RawResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/RawResource.cpp b/third_party/WebKit/Source/core/fetch/RawResource.cpp
index ecc96ed07e3619c41a7aa4449f386b3d0785badc..04af5ba365c03bdcc6dca5da8d7450b33db3d9b7 100644
--- a/third_party/WebKit/Source/core/fetch/RawResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/RawResource.cpp
@@ -35,10 +35,11 @@
namespace blink {
-Resource* RawResource::fetchSynchronously(FetchRequest& request,
- ResourceFetcher* fetcher) {
+RawResource* RawResource::fetchSynchronously(FetchRequest& request,
+ ResourceFetcher* fetcher) {
request.makeSynchronous();
- return fetcher->requestResource(request, RawResourceFactory(Resource::Raw));
+ return toRawResource(
+ fetcher->requestResource(request, RawResourceFactory(Resource::Raw)));
}
RawResource* RawResource::fetchImport(FetchRequest& request,
@@ -156,24 +157,6 @@ void RawResource::didAddClient(ResourceClient* c) {
Resource::didAddClient(client);
}
-bool RawResource::willFollowRedirect(const ResourceRequest& newRequest,
- const ResourceResponse& redirectResponse) {
- bool follow = Resource::willFollowRedirect(newRequest, redirectResponse);
- // The base class method takes a non const reference of a ResourceRequest
- // and returns bool just for allowing RawResource to reject redirect. It
- // must always return true.
- DCHECK(follow);
-
- DCHECK(!redirectResponse.isNull());
- ResourceClientWalker<RawResourceClient> w(clients());
- while (RawResourceClient* c = w.next()) {
- if (!c->redirectReceived(this, newRequest, redirectResponse))
- follow = false;
- }
-
- return follow;
-}
-
void RawResource::willNotFollowRedirect() {
ResourceClientWalker<RawResourceClient> w(clients());
while (RawResourceClient* c = w.next())
@@ -297,6 +280,24 @@ bool RawResource::canReuse(const ResourceRequest& newRequest) const {
return true;
}
+bool RawResource::willFollowRedirect(const ResourceRequest& newRequest,
hiroshige 2017/01/17 19:28:42 What is the reason for moving this funtion definit
Takashi Toyoshima 2017/01/19 04:08:20 I just prefer to have definitions in the same orde
+ const ResourceResponse& redirectResponse) {
+ bool follow = Resource::willFollowRedirect(newRequest, redirectResponse);
+ // The base class method takes a const reference of a ResourceRequest and
+ // returns bool just for allowing RawResource to reject redirect. It must
+ // always return true.
+ DCHECK(follow);
+
+ DCHECK(!redirectResponse.isNull());
+ ResourceClientWalker<RawResourceClient> w(clients());
+ while (RawResourceClient* c = w.next()) {
+ if (!c->redirectReceived(this, newRequest, redirectResponse))
+ follow = false;
+ }
+
+ return follow;
+}
+
RawResourceClientStateChecker::RawResourceClientStateChecker()
: m_state(NotAddedAsClient) {}

Powered by Google App Engine
This is Rietveld 408576698