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

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 15 matching lines...) Expand all
26 #include "core/fetch/CachedMetadata.h" 26 #include "core/fetch/CachedMetadata.h"
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/Logging.h" 35 #include "platform/Logging.h"
36 #include "platform/RuntimeEnabledFeatures.h"
36 #include "platform/SharedBuffer.h" 37 #include "platform/SharedBuffer.h"
37 #include "platform/TraceEvent.h" 38 #include "platform/TraceEvent.h"
38 #include "platform/network/HTTPParsers.h" 39 #include "platform/network/HTTPParsers.h"
39 #include "platform/weborigin/KURL.h" 40 #include "platform/weborigin/KURL.h"
40 #include "public/platform/Platform.h" 41 #include "public/platform/Platform.h"
41 #include "public/platform/WebScheduler.h" 42 #include "public/platform/WebScheduler.h"
42 #include "public/platform/WebSecurityOrigin.h" 43 #include "public/platform/WebSecurityOrigin.h"
43 #include "wtf/CurrentTime.h" 44 #include "wtf/CurrentTime.h"
44 #include "wtf/MathExtras.h" 45 #include "wtf/MathExtras.h"
45 #include "wtf/StdLibExtras.h" 46 #include "wtf/StdLibExtras.h"
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 { 567 {
567 if (!m_data) 568 if (!m_data)
568 return false; 569 return false;
569 570
570 if (!m_data->isLocked()) 571 if (!m_data->isLocked())
571 return true; 572 return true;
572 573
573 if (!memoryCache()->contains(this) || hasClientsOrObservers() || !m_revalida tingRequest.isNull() || !m_loadFinishTime || !isSafeToUnlock()) 574 if (!memoryCache()->contains(this) || hasClientsOrObservers() || !m_revalida tingRequest.isNull() || !m_loadFinishTime || !isSafeToUnlock())
574 return false; 575 return false;
575 576
577 if (RuntimeEnabledFeatures::doNotUnlockSharedBufferEnabled())
578 return false;
579
576 m_data->unlock(); 580 m_data->unlock();
577 return true; 581 return true;
578 } 582 }
579 583
580 void Resource::responseReceived(const ResourceResponse& response, PassOwnPtr<Web DataConsumerHandle>) 584 void Resource::responseReceived(const ResourceResponse& response, PassOwnPtr<Web DataConsumerHandle>)
581 { 585 {
582 m_responseTimestamp = currentTime(); 586 m_responseTimestamp = currentTime();
583 587
584 if (!m_revalidatingRequest.isNull()) { 588 if (!m_revalidatingRequest.isNull()) {
585 if (response.httpStatusCode() == 304) { 589 if (response.httpStatusCode() == 304) {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 case Resource::Media: 1125 case Resource::Media:
1122 return "Media"; 1126 return "Media";
1123 case Resource::Manifest: 1127 case Resource::Manifest:
1124 return "Manifest"; 1128 return "Manifest";
1125 } 1129 }
1126 ASSERT_NOT_REACHED(); 1130 ASSERT_NOT_REACHED();
1127 return "Unknown"; 1131 return "Unknown";
1128 } 1132 }
1129 1133
1130 } // namespace blink 1134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698