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

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

Issue 1264453002: Split the constructor of ThreadableLoader into two methods (ctor and start()) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed pipes around non-variables in a comment Created 4 years, 10 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) 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class Document; 50 class Document;
51 class KURL; 51 class KURL;
52 class ResourceRequest; 52 class ResourceRequest;
53 class SecurityOrigin; 53 class SecurityOrigin;
54 class ThreadableLoaderClient; 54 class ThreadableLoaderClient;
55 55
56 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv ate RawResourceClient { 56 class CORE_EXPORT DocumentThreadableLoader final : public ThreadableLoader, priv ate RawResourceClient {
57 USING_FAST_MALLOC(DocumentThreadableLoader); 57 USING_FAST_MALLOC(DocumentThreadableLoader);
58 public: 58 public:
59 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&);
60 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable LoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&, const Res ourceLoaderOptions&); 60 static PassRefPtr<DocumentThreadableLoader> create(Document&, Threadable LoaderClient*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&);
61 ~DocumentThreadableLoader() override; 61 ~DocumentThreadableLoader() override;
62 62
63 void start(const ResourceRequest&) override;
64
63 void overrideTimeout(unsigned long timeout) override; 65 void overrideTimeout(unsigned long timeout) override;
64 66
65 // |this| may be dead after calling this method in async mode. 67 // |this| may be dead after calling this method in async mode.
66 void cancel() override; 68 void cancel() override;
67 void setDefersLoading(bool); 69 void setDefersLoading(bool);
68 70
69 private: 71 private:
70 enum BlockingBehavior { 72 enum BlockingBehavior {
71 LoadSynchronously, 73 LoadSynchronously,
72 LoadAsynchronously 74 LoadAsynchronously
73 }; 75 };
74 76
75 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh avior, const ResourceRequest&, const ThreadableLoaderOptions&, const ResourceLoa derOptions&); 77 DocumentThreadableLoader(Document&, ThreadableLoaderClient*, BlockingBeh avior, const ThreadableLoaderOptions&, const ResourceLoaderOptions&);
76 78
77 void clear(); 79 void clear();
78 80
79 // ResourceClient 81 // ResourceClient
80 // 82 //
81 // |this| may be dead after calling this method. 83 // |this| may be dead after calling this method.
82 void notifyFinished(Resource*) override; 84 void notifyFinished(Resource*) override;
83 85
84 String debugName() const override { return "DocumentThreadableLoader"; } 86 String debugName() const override { return "DocumentThreadableLoader"; }
85 87
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // Set to true if the current request is cross-origin and not simple. 193 // Set to true if the current request is cross-origin and not simple.
192 bool m_crossOriginNonSimpleRequest; 194 bool m_crossOriginNonSimpleRequest;
193 195
194 // Set to true when the response data is given to a data consumer 196 // Set to true when the response data is given to a data consumer
195 // handle. 197 // handle.
196 bool m_isUsingDataConsumerHandle; 198 bool m_isUsingDataConsumerHandle;
197 199
198 const bool m_async; 200 const bool m_async;
199 201
200 // Holds the original request context (used for sanity checks). 202 // Holds the original request context (used for sanity checks).
201 const WebURLRequest::RequestContext m_requestContext; 203 WebURLRequest::RequestContext m_requestContext;
202 204
203 // Holds the original request for fallback in case the Service Worker 205 // Holds the original request for fallback in case the Service Worker
204 // does not respond. 206 // does not respond.
205 ResourceRequest m_fallbackRequestForServiceWorker; 207 ResourceRequest m_fallbackRequestForServiceWorker;
206 208
207 // Holds the original request and options for it during preflight 209 // Holds the original request and options for it during preflight
208 // request handling phase. 210 // request handling phase.
209 ResourceRequest m_actualRequest; 211 ResourceRequest m_actualRequest;
210 ResourceLoaderOptions m_actualOptions; 212 ResourceLoaderOptions m_actualOptions;
211 213
212 HTTPHeaderMap m_simpleRequestHeaders; // stores simple request headers i n case of a cross-origin redirect. 214 HTTPHeaderMap m_simpleRequestHeaders; // stores simple request headers i n case of a cross-origin redirect.
213 Timer<DocumentThreadableLoader> m_timeoutTimer; 215 Timer<DocumentThreadableLoader> m_timeoutTimer;
214 double m_requestStartedSeconds; // Time an asynchronous fetch request is started 216 double m_requestStartedSeconds; // Time an asynchronous fetch request is started
215 217
216 // Max number of times that this DocumentThreadableLoader can follow 218 // Max number of times that this DocumentThreadableLoader can follow
217 // cross-origin redirects. 219 // cross-origin redirects.
218 // This is used to limit the number of redirects. 220 // This is used to limit the number of redirects.
219 // But this value is not the max number of total redirects allowed, 221 // But this value is not the max number of total redirects allowed,
220 // because same-origin redirects are not counted here. 222 // because same-origin redirects are not counted here.
221 int m_corsRedirectLimit; 223 int m_corsRedirectLimit;
222 224
223 const WebURLRequest::FetchRedirectMode m_redirectMode; 225 WebURLRequest::FetchRedirectMode m_redirectMode;
224 }; 226 };
225 227
226 } // namespace blink 228 } // namespace blink
227 229
228 #endif // DocumentThreadableLoader_h 230 #endif // DocumentThreadableLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698