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

Side by Side Diff: Source/core/fetch/ResourceFetcher.h

Issue 1003763002: Oilpan: mark ResourceCacheValidationSuppressor as a stack allocated object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 4 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 5 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 17 matching lines...) Expand all
28 28
29 #include "core/fetch/CachePolicy.h" 29 #include "core/fetch/CachePolicy.h"
30 #include "core/fetch/FetchContext.h" 30 #include "core/fetch/FetchContext.h"
31 #include "core/fetch/FetchInitiatorInfo.h" 31 #include "core/fetch/FetchInitiatorInfo.h"
32 #include "core/fetch/FetchRequest.h" 32 #include "core/fetch/FetchRequest.h"
33 #include "core/fetch/Resource.h" 33 #include "core/fetch/Resource.h"
34 #include "core/fetch/ResourceLoaderHost.h" 34 #include "core/fetch/ResourceLoaderHost.h"
35 #include "core/fetch/ResourceLoaderOptions.h" 35 #include "core/fetch/ResourceLoaderOptions.h"
36 #include "core/fetch/ResourcePtr.h" 36 #include "core/fetch/ResourcePtr.h"
37 #include "platform/Timer.h" 37 #include "platform/Timer.h"
38 #include "wtf/Deque.h"
39 #include "wtf/HashMap.h" 38 #include "wtf/HashMap.h"
40 #include "wtf/HashSet.h" 39 #include "wtf/HashSet.h"
41 #include "wtf/ListHashSet.h" 40 #include "wtf/ListHashSet.h"
42 #include "wtf/text/StringHash.h" 41 #include "wtf/text/StringHash.h"
43 42
44 namespace blink { 43 namespace blink {
45 44
46 class ArchiveResourceCollection; 45 class ArchiveResourceCollection;
47 class CSSStyleSheetResource; 46 class CSSStyleSheetResource;
48 class DocumentResource; 47 class DocumentResource;
(...skipping 16 matching lines...) Expand all
65 // and enforces a bunch of security checks and rules for resource revalidation. 64 // and enforces a bunch of security checks and rules for resource revalidation.
66 // Its lifetime is roughly per-DocumentLoader, in that it is generally created 65 // Its lifetime is roughly per-DocumentLoader, in that it is generally created
67 // in the DocumentLoader constructor and loses its ability to generate network 66 // in the DocumentLoader constructor and loses its ability to generate network
68 // requests when the DocumentLoader is destroyed. Documents also hold a 67 // requests when the DocumentLoader is destroyed. Documents also hold a
69 // RefPtr<ResourceFetcher> for their lifetime (and will create one if they 68 // RefPtr<ResourceFetcher> for their lifetime (and will create one if they
70 // are initialized without a LocalFrame), so a Document can keep a ResourceFetch er 69 // are initialized without a LocalFrame), so a Document can keep a ResourceFetch er
71 // alive past detach if scripts still reference the Document. 70 // alive past detach if scripts still reference the Document.
72 class ResourceFetcher final : public RefCountedWillBeGarbageCollectedFinalized<R esourceFetcher>, public ResourceLoaderHost { 71 class ResourceFetcher final : public RefCountedWillBeGarbageCollectedFinalized<R esourceFetcher>, public ResourceLoaderHost {
73 WTF_MAKE_NONCOPYABLE(ResourceFetcher); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOV ED; 72 WTF_MAKE_NONCOPYABLE(ResourceFetcher); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOV ED;
74 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ResourceFetcher); 73 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ResourceFetcher);
75 friend class ImageLoader;
76 friend class ResourceCacheValidationSuppressor;
77
78 public: 74 public:
79 static PassRefPtrWillBeRawPtr<ResourceFetcher> create(PassOwnPtrWillBeRawPtr <FetchContext> context) { return adoptRefWillBeNoop(new ResourceFetcher(context) ); } 75 static PassRefPtrWillBeRawPtr<ResourceFetcher> create(PassOwnPtrWillBeRawPtr <FetchContext> context) { return adoptRefWillBeNoop(new ResourceFetcher(context) ); }
80 virtual ~ResourceFetcher(); 76 virtual ~ResourceFetcher();
81 DECLARE_VIRTUAL_TRACE(); 77 DECLARE_VIRTUAL_TRACE();
82 78
83 #if !ENABLE(OILPAN) 79 #if !ENABLE(OILPAN)
84 using RefCounted<ResourceFetcher>::ref; 80 using RefCounted<ResourceFetcher>::ref;
85 using RefCounted<ResourceFetcher>::deref; 81 using RefCounted<ResourceFetcher>::deref;
86 #endif 82 #endif
87 83
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void requestLoadStarted(Resource*, const FetchRequest&, ResourceLoadStartTyp e); 167 void requestLoadStarted(Resource*, const FetchRequest&, ResourceLoadStartTyp e);
172 static const ResourceLoaderOptions& defaultResourceOptions(); 168 static const ResourceLoaderOptions& defaultResourceOptions();
173 169
174 String getCacheIdentifier() const; 170 String getCacheIdentifier() const;
175 171
176 virtual ResourceLoaderHost::LoaderHostType objectType() const override { ret urn ResourceFetcherType; }; 172 virtual ResourceLoaderHost::LoaderHostType objectType() const override { ret urn ResourceFetcherType; };
177 173
178 static ResourceFetcher* toResourceFetcher(ResourceLoaderHost*); 174 static ResourceFetcher* toResourceFetcher(ResourceLoaderHost*);
179 175
180 private: 176 private:
177 friend class ImageLoader;
178 friend class ResourceCacheValidationSuppressor;
181 friend class ResourceFetcherUpgradeTest; 179 friend class ResourceFetcherUpgradeTest;
182 friend class ResourceFetcherHintsTest; 180 friend class ResourceFetcherHintsTest;
183 181
184 explicit ResourceFetcher(PassOwnPtrWillBeRawPtr<FetchContext>); 182 explicit ResourceFetcher(PassOwnPtrWillBeRawPtr<FetchContext>);
185 183
186 bool shouldLoadNewResource(Resource::Type) const; 184 bool shouldLoadNewResource(Resource::Type) const;
187 185
188 ResourcePtr<Resource> requestResource(Resource::Type, FetchRequest&); 186 ResourcePtr<Resource> requestResource(Resource::Type, FetchRequest&);
189 ResourcePtr<Resource> createResourceForRevalidation(const FetchRequest&, Res ource*); 187 ResourcePtr<Resource> createResourceForRevalidation(const FetchRequest&, Res ource*);
190 ResourcePtr<Resource> createResourceForLoading(Resource::Type, FetchRequest& , const String& charset); 188 ResourcePtr<Resource> createResourceForLoading(Resource::Type, FetchRequest& , const String& charset);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 DeadResourceStatsRecorder m_deadStatsRecorder; 250 DeadResourceStatsRecorder m_deadStatsRecorder;
253 251
254 // 29 bits left 252 // 29 bits left
255 bool m_autoLoadImages : 1; 253 bool m_autoLoadImages : 1;
256 bool m_imagesEnabled : 1; 254 bool m_imagesEnabled : 1;
257 bool m_allowStaleResources : 1; 255 bool m_allowStaleResources : 1;
258 }; 256 };
259 257
260 class ResourceCacheValidationSuppressor { 258 class ResourceCacheValidationSuppressor {
261 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor); 259 WTF_MAKE_NONCOPYABLE(ResourceCacheValidationSuppressor);
262 WTF_MAKE_FAST_ALLOCATED; 260 STACK_ALLOCATED();
263 public: 261 public:
264 ResourceCacheValidationSuppressor(ResourceFetcher* loader) 262 ResourceCacheValidationSuppressor(ResourceFetcher* loader)
265 : m_loader(loader) 263 : m_loader(loader)
266 , m_previousState(false) 264 , m_previousState(false)
267 { 265 {
268 if (m_loader) { 266 if (m_loader) {
269 m_previousState = m_loader->m_allowStaleResources; 267 m_previousState = m_loader->m_allowStaleResources;
270 m_loader->m_allowStaleResources = true; 268 m_loader->m_allowStaleResources = true;
271 } 269 }
272 } 270 }
273 ~ResourceCacheValidationSuppressor() 271 ~ResourceCacheValidationSuppressor()
274 { 272 {
275 if (m_loader) 273 if (m_loader)
276 m_loader->m_allowStaleResources = m_previousState; 274 m_loader->m_allowStaleResources = m_previousState;
277 } 275 }
278 private: 276 private:
279 ResourceFetcher* m_loader; 277 RawPtrWillBeMember<ResourceFetcher> m_loader;
280 bool m_previousState; 278 bool m_previousState;
281 }; 279 };
282 280
283 } // namespace blink 281 } // namespace blink
284 282
285 #endif 283 #endif // ResourceFetcher_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698