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

Side by Side Diff: third_party/WebKit/Source/platform/loader/fetch/Resource.cpp

Issue 2834733003: Separate preaload matching from MemoryCache (Closed)
Patch Set: fix Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
7 rights reserved. 7 rights reserved.
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 24 matching lines...) Expand all
35 #include "platform/WebTaskRunner.h" 35 #include "platform/WebTaskRunner.h"
36 #include "platform/instrumentation/tracing/TraceEvent.h" 36 #include "platform/instrumentation/tracing/TraceEvent.h"
37 #include "platform/loader/fetch/CachedMetadata.h" 37 #include "platform/loader/fetch/CachedMetadata.h"
38 #include "platform/loader/fetch/CrossOriginAccessControl.h" 38 #include "platform/loader/fetch/CrossOriginAccessControl.h"
39 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" 39 #include "platform/loader/fetch/FetchInitiatorTypeNames.h"
40 #include "platform/loader/fetch/FetchParameters.h" 40 #include "platform/loader/fetch/FetchParameters.h"
41 #include "platform/loader/fetch/IntegrityMetadata.h" 41 #include "platform/loader/fetch/IntegrityMetadata.h"
42 #include "platform/loader/fetch/MemoryCache.h" 42 #include "platform/loader/fetch/MemoryCache.h"
43 #include "platform/loader/fetch/ResourceClient.h" 43 #include "platform/loader/fetch/ResourceClient.h"
44 #include "platform/loader/fetch/ResourceClientWalker.h" 44 #include "platform/loader/fetch/ResourceClientWalker.h"
45 #include "platform/loader/fetch/ResourceFetcher.h"
45 #include "platform/loader/fetch/ResourceLoader.h" 46 #include "platform/loader/fetch/ResourceLoader.h"
46 #include "platform/network/HTTPParsers.h" 47 #include "platform/network/HTTPParsers.h"
47 #include "platform/weborigin/KURL.h" 48 #include "platform/weborigin/KURL.h"
48 #include "platform/wtf/CurrentTime.h" 49 #include "platform/wtf/CurrentTime.h"
49 #include "platform/wtf/MathExtras.h" 50 #include "platform/wtf/MathExtras.h"
50 #include "platform/wtf/StdLibExtras.h" 51 #include "platform/wtf/StdLibExtras.h"
51 #include "platform/wtf/Vector.h" 52 #include "platform/wtf/Vector.h"
52 #include "platform/wtf/text/CString.h" 53 #include "platform/wtf/text/CString.h"
53 #include "platform/wtf/text/StringBuilder.h" 54 #include "platform/wtf/text/StringBuilder.h"
54 #include "public/platform/Platform.h" 55 #include "public/platform/Platform.h"
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 options_.data_buffering_policy = data_buffering_policy; 412 options_.data_buffering_policy = data_buffering_policy;
412 ClearData(); 413 ClearData();
413 SetEncodedSize(0); 414 SetEncodedSize(0);
414 } 415 }
415 416
416 void Resource::GetError(const ResourceError& error) { 417 void Resource::GetError(const ResourceError& error) {
417 DCHECK(!error.IsNull()); 418 DCHECK(!error.IsNull());
418 error_ = error; 419 error_ = error;
419 is_revalidating_ = false; 420 is_revalidating_ = false;
420 421
421 if (error_.IsCancellation() || !IsPreloaded()) 422 if (error_.IsCancellation() || !IsPreloaded()) {
422 GetMemoryCache()->Remove(this); 423 GetMemoryCache()->Remove(this);
424 if (loader_)
425 loader_->Fetcher()->RemovePreload(this);
426 }
423 427
424 if (!ErrorOccurred()) 428 if (!ErrorOccurred())
425 SetStatus(ResourceStatus::kLoadError); 429 SetStatus(ResourceStatus::kLoadError);
426 DCHECK(ErrorOccurred()); 430 DCHECK(ErrorOccurred());
427 ClearData(); 431 ClearData();
428 loader_ = nullptr; 432 loader_ = nullptr;
429 CheckNotify(); 433 CheckNotify();
430 } 434 }
431 435
432 void Resource::Finish(double load_finish_time) { 436 void Resource::Finish(double load_finish_time) {
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 case Resource::kMedia: 1132 case Resource::kMedia:
1129 case Resource::kManifest: 1133 case Resource::kManifest:
1130 case Resource::kMock: 1134 case Resource::kMock:
1131 return false; 1135 return false;
1132 } 1136 }
1133 NOTREACHED(); 1137 NOTREACHED();
1134 return false; 1138 return false;
1135 } 1139 }
1136 1140
1137 } // namespace blink 1141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698