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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h

Issue 2225733002: Revert of Move ThreadableLoader to Oilpan heap (3/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onheap-threadable-loader
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp » ('j') | 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) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include <memory> 47 #include <memory>
48 48
49 namespace blink { 49 namespace blink {
50 50
51 class Document; 51 class Document;
52 class KURL; 52 class KURL;
53 class ResourceRequest; 53 class ResourceRequest;
54 class SecurityOrigin; 54 class SecurityOrigin;
55 class ThreadableLoaderClient; 55 class ThreadableLoaderClient;
56 56
57 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv ate ResourceOwner<RawResource> { 57 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv ate RawResourceClient {
58 USING_GARBAGE_COLLECTED_MIXIN(DocumentThreadableLoader);
59 public: 58 public:
60 static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp tions&); 59 static void loadResourceSynchronously(Document&, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&, const ResourceLoaderOp tions&);
61 static DocumentThreadableLoader* create(Document&, ThreadableLoaderClien t*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&); 60 static DocumentThreadableLoader* create(Document&, ThreadableLoaderClien t*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&);
62 ~DocumentThreadableLoader() override; 61 ~DocumentThreadableLoader() override;
63 62
64 void start(const ResourceRequest&) override; 63 void start(const ResourceRequest&) override;
65 64
66 void overrideTimeout(unsigned long timeout) override; 65 void overrideTimeout(unsigned long timeout) override;
67 66
68 // |this| may be dead after calling this method in async mode. 67 // |this| may be dead after calling this method in async mode.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // |this| may be dead after calling this method. 143 // |this| may be dead after calling this method.
145 void handleError(const ResourceError&); 144 void handleError(const ResourceError&);
146 145
147 void loadRequest(const ResourceRequest&, ResourceLoaderOptions); 146 void loadRequest(const ResourceRequest&, ResourceLoaderOptions);
148 bool isAllowedRedirect(const KURL&) const; 147 bool isAllowedRedirect(const KURL&) const;
149 // Returns DoNotAllowStoredCredentials 148 // Returns DoNotAllowStoredCredentials
150 // if m_forceDoNotAllowStoredCredentials is set. Otherwise, just 149 // if m_forceDoNotAllowStoredCredentials is set. Otherwise, just
151 // returns allowCredentials value of m_resourceLoaderOptions. 150 // returns allowCredentials value of m_resourceLoaderOptions.
152 StoredCredentials effectiveAllowCredentials() const; 151 StoredCredentials effectiveAllowCredentials() const;
153 152
153 // TODO(oilpan): DocumentThreadableLoader used to be a ResourceOwner,
154 // but ResourceOwner was moved onto the oilpan heap before
155 // DocumentThreadableLoader was ready. When DocumentThreadableLoader
156 // moves onto the oilpan heap, make it a ResourceOwner again and remove
157 // this re-implementation of ResourceOwner.
158 RawResource* resource() const { return m_resource.get(); }
159 void clearResource() { setResource(nullptr); }
160 void setResource(RawResource* newResource)
161 {
162 if (newResource == m_resource)
163 return;
164
165 if (RawResource* oldResource = m_resource.release())
166 oldResource->removeClient(this);
167
168 if (newResource) {
169 m_resource = newResource;
170 m_resource->addClient(this);
171 }
172 }
173 Member<RawResource> m_resource;
174 // End of ResourceOwner re-implementation, see above.
175
154 SecurityOrigin* getSecurityOrigin() const; 176 SecurityOrigin* getSecurityOrigin() const;
155 Document& document() const; 177 Document& document() const;
156 178
157 ThreadableLoaderClient* m_client; 179 ThreadableLoaderClient* m_client;
158 Member<Document> m_document; 180 Member<Document> m_document;
159 181
160 const ThreadableLoaderOptions m_options; 182 const ThreadableLoaderOptions m_options;
161 // Some items may be overridden by m_forceDoNotAllowStoredCredentials 183 // Some items may be overridden by m_forceDoNotAllowStoredCredentials
162 // and m_securityOrigin. In such a case, build a ResourceLoaderOptions 184 // and m_securityOrigin. In such a case, build a ResourceLoaderOptions
163 // with up-to-date values from them and this variable, and use it. 185 // with up-to-date values from them and this variable, and use it.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // header when following the redirect. 231 // header when following the redirect.
210 bool m_didRedirect; 232 bool m_didRedirect;
211 Referrer m_referrerAfterRedirect; 233 Referrer m_referrerAfterRedirect;
212 234
213 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory; 235 WeakPtrFactory<DocumentThreadableLoader> m_weakFactory;
214 }; 236 };
215 237
216 } // namespace blink 238 } // namespace blink
217 239
218 #endif // DocumentThreadableLoader_h 240 #endif // DocumentThreadableLoader_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698