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

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

Issue 2146403004: ThreadableLoader::cancel should be called before loader destruction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@onheap-threadable-loader-client-wrapper
Patch Set: fix Created 4 years, 5 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 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 void didReceiveCachedMetadata(std::unique_ptr<Vector<char>> data) 84 void didReceiveCachedMetadata(std::unique_ptr<Vector<char>> data)
85 { 85 {
86 if (m_client) 86 if (m_client)
87 m_client->didReceiveCachedMetadata(data->data(), data->size()); 87 m_client->didReceiveCachedMetadata(data->data(), data->size());
88 } 88 }
89 89
90 void didFinishLoading(unsigned long identifier, double finishTime) 90 void didFinishLoading(unsigned long identifier, double finishTime)
91 { 91 {
92 m_done = true; 92 m_done = true;
93 if (m_client) 93 if (m_client) {
94 m_client->didFinishLoading(identifier, finishTime); 94 ThreadableLoaderClient* client = m_client;
hiroshige 2016/07/19 06:56:14 Lines 93--127: same as the comment for DocumentThr
yhirano 2016/07/19 08:05:04 Yes
95 m_client = nullptr;
96 client->didFinishLoading(identifier, finishTime);
97 }
95 } 98 }
96 99
97 void didFail(const ResourceError& error) 100 void didFail(const ResourceError& error)
98 { 101 {
99 m_done = true; 102 m_done = true;
100 if (m_client) 103 if (m_client) {
101 m_client->didFail(error); 104 ThreadableLoaderClient* client = m_client;
105 m_client = nullptr;
106 client->didFail(error);
107 }
102 } 108 }
103 109
104 void didFailAccessControlCheck(const ResourceError& error) 110 void didFailAccessControlCheck(const ResourceError& error)
105 { 111 {
106 m_done = true; 112 m_done = true;
107 if (m_client) 113 if (m_client) {
108 m_client->didFailAccessControlCheck(error); 114 ThreadableLoaderClient* client = m_client;
115 m_client = nullptr;
116 client->didFailAccessControlCheck(error);
117 }
109 } 118 }
110 119
111 void didFailRedirectCheck() 120 void didFailRedirectCheck()
112 { 121 {
113 m_done = true; 122 m_done = true;
114 if (m_client) 123 if (m_client) {
115 m_client->didFailRedirectCheck(); 124 ThreadableLoaderClient* client = m_client;
125 m_client = nullptr;
126 client->didFailRedirectCheck();
127 }
116 } 128 }
117 129
118 void didDownloadData(int dataLength) 130 void didDownloadData(int dataLength)
119 { 131 {
120 if (m_client) 132 if (m_client)
121 m_client->didDownloadData(dataLength); 133 m_client->didDownloadData(dataLength);
122 } 134 }
123 135
124 void didReceiveResourceTiming(std::unique_ptr<CrossThreadResourceTimingInfoD ata> timingData) 136 void didReceiveResourceTiming(std::unique_ptr<CrossThreadResourceTimingInfoD ata> timingData)
125 { 137 {
(...skipping 11 matching lines...) Expand all
137 149
138 private: 150 private:
139 Member<WorkerGlobalScope> m_workerGlobalScope; 151 Member<WorkerGlobalScope> m_workerGlobalScope;
140 ThreadableLoaderClient* m_client = nullptr; 152 ThreadableLoaderClient* m_client = nullptr;
141 bool m_done = false; 153 bool m_done = false;
142 }; 154 };
143 155
144 } // namespace blink 156 } // namespace blink
145 157
146 #endif // ThreadableLoaderClientWrapper_h 158 #endif // ThreadableLoaderClientWrapper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698