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

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

Issue 1915113005: [WeakMemoryCache] Field-Trial: Make Reference from MemoryCache to Resource weak (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@MemoryCache_1b0
Patch Set: Rebase. Created 4 years, 6 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 rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 16 matching lines...) Expand all
27 #include "core/fetch/CrossOriginAccessControl.h" 27 #include "core/fetch/CrossOriginAccessControl.h"
28 #include "core/fetch/FetchInitiatorTypeNames.h" 28 #include "core/fetch/FetchInitiatorTypeNames.h"
29 #include "core/fetch/MemoryCache.h" 29 #include "core/fetch/MemoryCache.h"
30 #include "core/fetch/ResourceClient.h" 30 #include "core/fetch/ResourceClient.h"
31 #include "core/fetch/ResourceClientOrObserverWalker.h" 31 #include "core/fetch/ResourceClientOrObserverWalker.h"
32 #include "core/fetch/ResourceFetcher.h" 32 #include "core/fetch/ResourceFetcher.h"
33 #include "core/fetch/ResourceLoader.h" 33 #include "core/fetch/ResourceLoader.h"
34 #include "core/inspector/InstanceCounters.h" 34 #include "core/inspector/InstanceCounters.h"
35 #include "platform/Histogram.h" 35 #include "platform/Histogram.h"
36 #include "platform/Logging.h" 36 #include "platform/Logging.h"
37 #include "platform/RuntimeEnabledFeatures.h"
37 #include "platform/SharedBuffer.h" 38 #include "platform/SharedBuffer.h"
38 #include "platform/TraceEvent.h" 39 #include "platform/TraceEvent.h"
39 #include "platform/network/HTTPParsers.h" 40 #include "platform/network/HTTPParsers.h"
40 #include "platform/weborigin/KURL.h" 41 #include "platform/weborigin/KURL.h"
41 #include "public/platform/Platform.h" 42 #include "public/platform/Platform.h"
42 #include "public/platform/WebScheduler.h" 43 #include "public/platform/WebScheduler.h"
43 #include "public/platform/WebSecurityOrigin.h" 44 #include "public/platform/WebSecurityOrigin.h"
44 #include "wtf/CurrentTime.h" 45 #include "wtf/CurrentTime.h"
45 #include "wtf/MathExtras.h" 46 #include "wtf/MathExtras.h"
46 #include "wtf/StdLibExtras.h" 47 #include "wtf/StdLibExtras.h"
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 { 569 {
569 if (!m_data) 570 if (!m_data)
570 return false; 571 return false;
571 572
572 if (!m_data->isLocked()) 573 if (!m_data->isLocked())
573 return true; 574 return true;
574 575
575 if (!memoryCache()->contains(this) || hasClientsOrObservers() || !m_revalida tingRequest.isNull() || !m_loadFinishTime || !isSafeToUnlock()) 576 if (!memoryCache()->contains(this) || hasClientsOrObservers() || !m_revalida tingRequest.isNull() || !m_loadFinishTime || !isSafeToUnlock())
576 return false; 577 return false;
577 578
579 if (RuntimeEnabledFeatures::doNotUnlockSharedBufferEnabled())
580 return false;
581
578 m_data->unlock(); 582 m_data->unlock();
579 return true; 583 return true;
580 } 584 }
581 585
582 void Resource::responseReceived(const ResourceResponse& response, PassOwnPtr<Web DataConsumerHandle>) 586 void Resource::responseReceived(const ResourceResponse& response, PassOwnPtr<Web DataConsumerHandle>)
583 { 587 {
584 m_responseTimestamp = currentTime(); 588 m_responseTimestamp = currentTime();
585 589
586 if (!m_revalidatingRequest.isNull()) { 590 if (!m_revalidatingRequest.isNull()) {
587 if (response.httpStatusCode() == 304) { 591 if (response.httpStatusCode() == 304) {
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 case Resource::Media: 1133 case Resource::Media:
1130 return "Media"; 1134 return "Media";
1131 case Resource::Manifest: 1135 case Resource::Manifest:
1132 return "Manifest"; 1136 return "Manifest";
1133 } 1137 }
1134 ASSERT_NOT_REACHED(); 1138 ASSERT_NOT_REACHED();
1135 return "Unknown"; 1139 return "Unknown";
1136 } 1140 }
1137 1141
1138 } // namespace blink 1142 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MemoryCache.cpp ('k') | third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698