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

Side by Side Diff: Source/core/loader/ThreadableLoaderClientWrapper.h

Issue 340363003: Let ThreadableLoaderClientWrapper's client handle failures better. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move all tests to a separate CL; functional change only. Created 6 years, 6 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 | 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 void didFail(const ResourceError& error) 91 void didFail(const ResourceError& error)
92 { 92 {
93 m_done = true; 93 m_done = true;
94 if (m_client) 94 if (m_client)
95 m_client->didFail(error); 95 m_client->didFail(error);
96 } 96 }
97 97
98 void didFailAccessControlCheck(const ResourceError& error) 98 void didFailAccessControlCheck(const ResourceError& error)
99 { 99 {
100 m_done = true; 100 // Let the client first handle the failure by possibly issuing
101 // a didFail() with a cancellation error before marking this
102 // wrapper as 'done'.
101 if (m_client) 103 if (m_client)
102 m_client->didFailAccessControlCheck(error); 104 m_client->didFailAccessControlCheck(error);
105 m_done = true;
abarth-chromium 2014/06/22 14:48:26 Is the client allowed to destroy |this| during the
sof 2014/06/22 15:49:14 I don't think it will be able to accomplish that p
103 } 106 }
104 107
105 void didFailRedirectCheck() 108 void didFailRedirectCheck()
106 { 109 {
107 m_done = true;
108 if (m_client) 110 if (m_client)
109 m_client->didFailRedirectCheck(); 111 m_client->didFailRedirectCheck();
112 m_done = true;
110 } 113 }
111 114
112 void didReceiveAuthenticationCancellation(unsigned long identifier, const Re sourceResponse& response) 115 void didReceiveAuthenticationCancellation(unsigned long identifier, const Re sourceResponse& response)
113 { 116 {
114 if (m_client) 117 if (m_client)
115 m_client->didReceiveResponse(identifier, response); 118 m_client->didReceiveResponse(identifier, response);
116 } 119 }
117 120
118 void didDownloadData(int dataLength) 121 void didDownloadData(int dataLength)
119 { 122 {
120 if (m_client) 123 if (m_client)
121 m_client->didDownloadData(dataLength); 124 m_client->didDownloadData(dataLength);
122 } 125 }
123 126
124 protected: 127 protected:
125 explicit ThreadableLoaderClientWrapper(ThreadableLoaderClient* client) 128 explicit ThreadableLoaderClientWrapper(ThreadableLoaderClient* client)
126 : m_client(client) 129 : m_client(client)
127 , m_done(false) 130 , m_done(false)
128 { 131 {
129 } 132 }
130 133
131 ThreadableLoaderClient* m_client; 134 ThreadableLoaderClient* m_client;
132 bool m_done; 135 bool m_done;
133 }; 136 };
134 137
135 } // namespace WebCore 138 } // namespace WebCore
136 139
137 #endif // ThreadableLoaderClientWrapper_h 140 #endif // ThreadableLoaderClientWrapper_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