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

Side by Side Diff: Source/core/workers/WorkerScriptLoader.cpp

Issue 618583002: Correct data size argument type in resource loading path to unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add static_cast to RELEASE_ASSERT in AssociatedURLLoader::ClientAdapter::didReceiveData Created 6 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 | « Source/core/workers/WorkerScriptLoader.h ('k') | Source/core/xml/XMLHttpRequest.h » ('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 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { 115 if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) {
116 m_failed = true; 116 m_failed = true;
117 return; 117 return;
118 } 118 }
119 m_responseURL = response.url(); 119 m_responseURL = response.url();
120 m_responseEncoding = response.textEncodingName(); 120 m_responseEncoding = response.textEncodingName();
121 if (m_client) 121 if (m_client)
122 m_client->didReceiveResponse(identifier, response); 122 m_client->didReceiveResponse(identifier, response);
123 } 123 }
124 124
125 void WorkerScriptLoader::didReceiveData(const char* data, int len) 125 void WorkerScriptLoader::didReceiveData(const char* data, unsigned len)
126 { 126 {
127 if (m_failed) 127 if (m_failed)
128 return; 128 return;
129 129
130 if (!m_decoder) { 130 if (!m_decoder) {
131 if (!m_responseEncoding.isEmpty()) 131 if (!m_responseEncoding.isEmpty())
132 m_decoder = TextResourceDecoder::create("text/javascript", m_respons eEncoding); 132 m_decoder = TextResourceDecoder::create("text/javascript", m_respons eEncoding);
133 else 133 else
134 m_decoder = TextResourceDecoder::create("text/javascript", "UTF-8"); 134 m_decoder = TextResourceDecoder::create("text/javascript", "UTF-8");
135 } 135 }
136 136
137 if (!len) 137 if (!len)
138 return; 138 return;
139 139
140 if (len == -1)
141 len = strlen(data);
142
143 m_script.append(m_decoder->decode(data, len)); 140 m_script.append(m_decoder->decode(data, len));
144 } 141 }
145 142
146 void WorkerScriptLoader::didFinishLoading(unsigned long identifier, double) 143 void WorkerScriptLoader::didFinishLoading(unsigned long identifier, double)
147 { 144 {
148 if (m_failed) { 145 if (m_failed) {
149 notifyError(); 146 notifyError();
150 return; 147 return;
151 } 148 }
152 149
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 void WorkerScriptLoader::notifyFinished() 184 void WorkerScriptLoader::notifyFinished()
188 { 185 {
189 if (!m_client || m_finishing) 186 if (!m_client || m_finishing)
190 return; 187 return;
191 188
192 m_finishing = true; 189 m_finishing = true;
193 m_client->notifyFinished(); 190 m_client->notifyFinished();
194 } 191 }
195 192
196 } // namespace blink 193 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerScriptLoader.h ('k') | Source/core/xml/XMLHttpRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698