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

Side by Side Diff: webkit/tools/test_shell/simple_resource_loader_bridge.cc

Issue 6771043: Enabled actual transfer size in chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed length_received to raw_data_length in didReceiveData on chromium side. Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file contains an implementation of the ResourceLoaderBridge class. 5 // This file contains an implementation of the ResourceLoaderBridge class.
6 // The class is implemented using net::URLRequest, meaning it is a "simple" 6 // The class is implemented using net::URLRequest, meaning it is a "simple"
7 // version that directly issues requests. The more complicated one used in the 7 // version that directly issues requests. The more complicated one used in the
8 // browser uses IPC. 8 // browser uses IPC.
9 // 9 //
10 // Because net::URLRequest only provides an asynchronous resource loading API, 10 // Because net::URLRequest only provides an asynchronous resource loading API,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // Continue reading more data into buf_ 298 // Continue reading more data into buf_
299 // Note: Doing this before notifying our peer ensures our load events get 299 // Note: Doing this before notifying our peer ensures our load events get
300 // dispatched in a manner consistent with DumpRenderTree (and also avoids a 300 // dispatched in a manner consistent with DumpRenderTree (and also avoids a
301 // race condition). If the order of the next 2 functions were reversed, the 301 // race condition). If the order of the next 2 functions were reversed, the
302 // peer could generate new requests in reponse to the received data, which 302 // peer could generate new requests in reponse to the received data, which
303 // when run on the io thread, could race against this function in doing 303 // when run on the io thread, could race against this function in doing
304 // another InvokeLater. See bug 769249. 304 // another InvokeLater. See bug 769249.
305 g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( 305 g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
306 this, &RequestProxy::AsyncReadData)); 306 this, &RequestProxy::AsyncReadData));
307 307
308 peer_->OnReceivedData(buf_copy.get(), bytes_read); 308 peer_->OnReceivedData(buf_copy.get(), bytes_read, -1);
darin (slow to review) 2011/04/08 15:47:18 so -1 means unknown? is that documented somewhere
vsevik 2011/04/08 16:23:48 Yes, -1 is unknown. It is now mentioned in the com
309 } 309 }
310 310
311 void NotifyDownloadedData(int bytes_read) { 311 void NotifyDownloadedData(int bytes_read) {
312 if (!peer_) 312 if (!peer_)
313 return; 313 return;
314 314
315 // Continue reading more data, see the comment in NotifyReceivedData. 315 // Continue reading more data, see the comment in NotifyReceivedData.
316 g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( 316 g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
317 this, &RequestProxy::AsyncReadData)); 317 this, &RequestProxy::AsyncReadData));
318 318
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 947
948 // static 948 // static
949 scoped_refptr<base::MessageLoopProxy> 949 scoped_refptr<base::MessageLoopProxy>
950 SimpleResourceLoaderBridge::GetIoThread() { 950 SimpleResourceLoaderBridge::GetIoThread() {
951 if (!EnsureIOThread()) { 951 if (!EnsureIOThread()) {
952 LOG(DFATAL) << "Failed to create IO thread."; 952 LOG(DFATAL) << "Failed to create IO thread.";
953 return NULL; 953 return NULL;
954 } 954 }
955 return g_io_thread->message_loop_proxy(); 955 return g_io_thread->message_loop_proxy();
956 } 956 }
OLDNEW
« webkit/glue/weburlloader_impl.cc ('K') | « webkit/plugins/ppapi/ppb_url_loader_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698