OLD | NEW |
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 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 response->url = params_->url; | 722 response->url = params_->url; |
723 | 723 |
724 proxy_ = new SyncRequestProxy(response); | 724 proxy_ = new SyncRequestProxy(response); |
725 proxy_->AddRef(); | 725 proxy_->AddRef(); |
726 | 726 |
727 proxy_->Start(NULL, params_.release()); | 727 proxy_->Start(NULL, params_.release()); |
728 | 728 |
729 static_cast<SyncRequestProxy*>(proxy_)->WaitForCompletion(); | 729 static_cast<SyncRequestProxy*>(proxy_)->WaitForCompletion(); |
730 } | 730 } |
731 | 731 |
732 virtual void UpdateRoutingId(int new_routing_id) { } | |
733 | |
734 private: | 732 private: |
735 // Ownership of params_ is transfered to the proxy when the proxy is created. | 733 // Ownership of params_ is transfered to the proxy when the proxy is created. |
736 scoped_ptr<RequestParams> params_; | 734 scoped_ptr<RequestParams> params_; |
737 | 735 |
738 // The request proxy is allocated when we start the request, and then it | 736 // The request proxy is allocated when we start the request, and then it |
739 // sticks around until this ResourceLoaderBridge is destroyed. | 737 // sticks around until this ResourceLoaderBridge is destroyed. |
740 RequestProxy* proxy_; | 738 RequestProxy* proxy_; |
741 }; | 739 }; |
742 | 740 |
743 //----------------------------------------------------------------------------- | 741 //----------------------------------------------------------------------------- |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 | 917 |
920 // static | 918 // static |
921 scoped_refptr<base::MessageLoopProxy> | 919 scoped_refptr<base::MessageLoopProxy> |
922 SimpleResourceLoaderBridge::GetIoThread() { | 920 SimpleResourceLoaderBridge::GetIoThread() { |
923 if (!EnsureIOThread()) { | 921 if (!EnsureIOThread()) { |
924 LOG(DFATAL) << "Failed to create IO thread."; | 922 LOG(DFATAL) << "Failed to create IO thread."; |
925 return NULL; | 923 return NULL; |
926 } | 924 } |
927 return g_io_thread->message_loop_proxy(); | 925 return g_io_thread->message_loop_proxy(); |
928 } | 926 } |
OLD | NEW |