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

Side by Side Diff: third_party/WebKit/Source/web/AssociatedURLLoader.cpp

Issue 2389633002: reflow comments in web/ (Closed)
Patch Set: . Created 4 years, 2 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/web/AssociatedURLLoaderTest.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) 2010, 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2011, 2012 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 void HTTPRequestHeaderValidator::visitHeader(const WebString& name, 74 void HTTPRequestHeaderValidator::visitHeader(const WebString& name,
75 const WebString& value) { 75 const WebString& value) {
76 m_isSafe = m_isSafe && isValidHTTPToken(name) && 76 m_isSafe = m_isSafe && isValidHTTPToken(name) &&
77 !FetchUtils::isForbiddenHeaderName(name) && 77 !FetchUtils::isForbiddenHeaderName(name) &&
78 isValidHTTPHeaderValue(value); 78 isValidHTTPHeaderValue(value);
79 } 79 }
80 80
81 } // namespace 81 } // namespace
82 82
83 // This class bridges the interface differences between WebCore and WebKit loade r clients. 83 // This class bridges the interface differences between WebCore and WebKit
84 // loader clients.
84 // It forwards its ThreadableLoaderClient notifications to a WebURLLoaderClient. 85 // It forwards its ThreadableLoaderClient notifications to a WebURLLoaderClient.
85 class AssociatedURLLoader::ClientAdapter final 86 class AssociatedURLLoader::ClientAdapter final
86 : public DocumentThreadableLoaderClient { 87 : public DocumentThreadableLoaderClient {
87 WTF_MAKE_NONCOPYABLE(ClientAdapter); 88 WTF_MAKE_NONCOPYABLE(ClientAdapter);
88 89
89 public: 90 public:
90 static std::unique_ptr<ClientAdapter> create(AssociatedURLLoader*, 91 static std::unique_ptr<ClientAdapter> create(AssociatedURLLoader*,
91 WebURLLoaderClient*, 92 WebURLLoaderClient*,
92 const WebURLLoaderOptions&); 93 const WebURLLoaderOptions&);
93 94
(...skipping 11 matching lines...) Expand all
105 void didFail(const ResourceError&) override; 106 void didFail(const ResourceError&) override;
106 void didFailRedirectCheck() override; 107 void didFailRedirectCheck() override;
107 // DocumentThreadableLoaderClient 108 // DocumentThreadableLoaderClient
108 void willFollowRedirect( 109 void willFollowRedirect(
109 ResourceRequest& /*newRequest*/, 110 ResourceRequest& /*newRequest*/,
110 const ResourceResponse& /*redirectResponse*/) override; 111 const ResourceResponse& /*redirectResponse*/) override;
111 112
112 // Sets an error to be reported back to the client, asychronously. 113 // Sets an error to be reported back to the client, asychronously.
113 void setDelayedError(const ResourceError&); 114 void setDelayedError(const ResourceError&);
114 115
115 // Enables forwarding of error notifications to the WebURLLoaderClient. These must be 116 // Enables forwarding of error notifications to the WebURLLoaderClient. These
116 // deferred until after the call to AssociatedURLLoader::loadAsynchronously() completes. 117 // must be deferred until after the call to
118 // AssociatedURLLoader::loadAsynchronously() completes.
117 void enableErrorNotifications(); 119 void enableErrorNotifications();
118 120
119 // Stops loading and releases the DocumentThreadableLoader as early as possibl e. 121 // Stops loading and releases the DocumentThreadableLoader as early as
122 // possible.
120 WebURLLoaderClient* releaseClient() { 123 WebURLLoaderClient* releaseClient() {
121 WebURLLoaderClient* client = m_client; 124 WebURLLoaderClient* client = m_client;
122 m_client = nullptr; 125 m_client = nullptr;
123 return client; 126 return client;
124 } 127 }
125 128
126 private: 129 private:
127 ClientAdapter(AssociatedURLLoader*, 130 ClientAdapter(AssociatedURLLoader*,
128 WebURLLoaderClient*, 131 WebURLLoaderClient*,
129 const WebURLLoaderOptions&); 132 const WebURLLoaderOptions&);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (m_enableErrorNotifications) 275 if (m_enableErrorNotifications)
273 notifyError(&m_errorTimer); 276 notifyError(&m_errorTimer);
274 } 277 }
275 278
276 void AssociatedURLLoader::ClientAdapter::didFailRedirectCheck() { 279 void AssociatedURLLoader::ClientAdapter::didFailRedirectCheck() {
277 didFail(ResourceError()); 280 didFail(ResourceError());
278 } 281 }
279 282
280 void AssociatedURLLoader::ClientAdapter::enableErrorNotifications() { 283 void AssociatedURLLoader::ClientAdapter::enableErrorNotifications() {
281 m_enableErrorNotifications = true; 284 m_enableErrorNotifications = true;
282 // If an error has already been received, start a timer to report it to the cl ient 285 // If an error has already been received, start a timer to report it to the
283 // after AssociatedURLLoader::loadAsynchronously has returned to the caller. 286 // client after AssociatedURLLoader::loadAsynchronously has returned to the
287 // caller.
284 if (m_didFail) 288 if (m_didFail)
285 m_errorTimer.startOneShot(0, BLINK_FROM_HERE); 289 m_errorTimer.startOneShot(0, BLINK_FROM_HERE);
286 } 290 }
287 291
288 void AssociatedURLLoader::ClientAdapter::notifyError(TimerBase* timer) { 292 void AssociatedURLLoader::ClientAdapter::notifyError(TimerBase* timer) {
289 ASSERT_UNUSED(timer, timer == &m_errorTimer); 293 ASSERT_UNUSED(timer, timer == &m_errorTimer);
290 294
291 if (!m_client) 295 if (!m_client)
292 return; 296 return;
293 297
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 390
387 ResourceLoaderOptions resourceLoaderOptions; 391 ResourceLoaderOptions resourceLoaderOptions;
388 resourceLoaderOptions.allowCredentials = m_options.allowCredentials 392 resourceLoaderOptions.allowCredentials = m_options.allowCredentials
389 ? AllowStoredCredentials 393 ? AllowStoredCredentials
390 : DoNotAllowStoredCredentials; 394 : DoNotAllowStoredCredentials;
391 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData; 395 resourceLoaderOptions.dataBufferingPolicy = DoNotBufferData;
392 396
393 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest(); 397 const ResourceRequest& webcoreRequest = newRequest.toResourceRequest();
394 if (webcoreRequest.requestContext() == 398 if (webcoreRequest.requestContext() ==
395 WebURLRequest::RequestContextUnspecified) { 399 WebURLRequest::RequestContextUnspecified) {
396 // FIXME: We load URLs without setting a TargetType (and therefore a reque st context) in several 400 // FIXME: We load URLs without setting a TargetType (and therefore a
397 // places in content/ (P2PPortAllocatorSession::AllocateLegacyRelaySession , for example). Remove 401 // request context) in several places in content/
398 // this once those places are patched up. 402 // (P2PPortAllocatorSession::AllocateLegacyRelaySession, for example).
403 // Remove this once those places are patched up.
399 newRequest.setRequestContext(WebURLRequest::RequestContextInternal); 404 newRequest.setRequestContext(WebURLRequest::RequestContextInternal);
400 } 405 }
401 406
402 Document* document = toDocument(m_observer->lifecycleContext()); 407 Document* document = toDocument(m_observer->lifecycleContext());
403 DCHECK(document); 408 DCHECK(document);
404 m_loader = DocumentThreadableLoader::create( 409 m_loader = DocumentThreadableLoader::create(
405 *document, m_clientAdapter.get(), options, resourceLoaderOptions); 410 *document, m_clientAdapter.get(), options, resourceLoaderOptions);
406 m_loader->start(webcoreRequest); 411 m_loader->start(webcoreRequest);
407 } 412 }
408 413
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 // there could be a WebURLLoader instance behind the 482 // there could be a WebURLLoader instance behind the
478 // DocumentThreadableLoader instance. So, for safety, we chose to just 483 // DocumentThreadableLoader instance. So, for safety, we chose to just
479 // crash here. 484 // crash here.
480 RELEASE_ASSERT(ThreadState::current()); 485 RELEASE_ASSERT(ThreadState::current());
481 486
482 m_observer->dispose(); 487 m_observer->dispose();
483 m_observer = nullptr; 488 m_observer = nullptr;
484 } 489 }
485 490
486 } // namespace blink 491 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698