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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceOwner.h

Issue 1976463003: Preload scan external CSS for @import (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: preload @import Created 4 years, 4 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 visitor->trace(m_resource); 69 visitor->trace(m_resource);
70 ResourceOwnerBase<C, std::is_base_of<GarbageCollectedMixin, C>::value>:: trace(visitor); 70 ResourceOwnerBase<C, std::is_base_of<GarbageCollectedMixin, C>::value>:: trace(visitor);
71 } 71 }
72 72
73 protected: 73 protected:
74 ResourceOwner() 74 ResourceOwner()
75 { 75 {
76 ThreadState::current()->registerPreFinalizer(this); 76 ThreadState::current()->registerPreFinalizer(this);
77 } 77 }
78 78
79 void setResource(ResourceType*); 79 void setResource(ResourceType*, Resource::PreloadReferencePolicy = Resource: :MarkAsReferenced);
80 void clearResource() { setResource(nullptr); } 80 void clearResource() { setResource(nullptr); }
81 81
82 private: 82 private:
83 Member<ResourceType> m_resource; 83 Member<ResourceType> m_resource;
84 }; 84 };
85 85
86 template<class R, class C> 86 template<class R, class C>
87 inline void ResourceOwner<R, C>::setResource(R* newResource) 87 inline void ResourceOwner<R, C>::setResource(R* newResource, Resource::PreloadRe ferencePolicy preloadReferencePolicy)
88 { 88 {
89 if (newResource == m_resource) 89 if (newResource == m_resource)
90 return; 90 return;
91 91
92 // Some ResourceClient implementations reenter this so 92 // Some ResourceClient implementations reenter this so
93 // we need to prevent double removal. 93 // we need to prevent double removal.
94 if (ResourceType* oldResource = m_resource.release()) 94 if (ResourceType* oldResource = m_resource.release())
95 oldResource->removeClient(this); 95 oldResource->removeClient(this);
96 96
97 if (newResource) { 97 if (newResource) {
98 m_resource = newResource; 98 m_resource = newResource;
99 m_resource->addClient(this); 99 m_resource->addClient(this, preloadReferencePolicy);
100 } 100 }
101 } 101 }
102 102
103 } // namespace blink 103 } // namespace blink
104 104
105 #endif 105 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698