| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 FileOverHTTPParams* g_file_over_http_params = NULL; | 116 FileOverHTTPParams* g_file_over_http_params = NULL; |
| 117 | 117 |
| 118 //----------------------------------------------------------------------------- | 118 //----------------------------------------------------------------------------- |
| 119 | 119 |
| 120 class IOThread : public base::Thread { | 120 class IOThread : public base::Thread { |
| 121 public: | 121 public: |
| 122 IOThread() : base::Thread("IOThread") { | 122 IOThread() : base::Thread("IOThread") { |
| 123 } | 123 } |
| 124 | 124 |
| 125 ~IOThread() { | 125 ~IOThread() { |
| 126 // We cannot rely on our base class to stop the thread since we want our | |
| 127 // CleanUp function to run. | |
| 128 Stop(); | 126 Stop(); |
| 129 } | 127 } |
| 130 | 128 |
| 131 virtual void Init() { | 129 virtual void Init() { |
| 132 if (g_request_context_params) { | 130 if (g_request_context_params) { |
| 133 g_request_context = new TestShellRequestContext( | 131 g_request_context = new TestShellRequestContext( |
| 134 g_request_context_params->cache_path, | 132 g_request_context_params->cache_path, |
| 135 g_request_context_params->cache_mode, | 133 g_request_context_params->cache_mode, |
| 136 g_request_context_params->no_proxy); | 134 g_request_context_params->no_proxy); |
| 137 delete g_request_context_params; | 135 delete g_request_context_params; |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 | 1040 |
| 1043 // static | 1041 // static |
| 1044 void SimpleResourceLoaderBridge::AllowFileOverHTTP( | 1042 void SimpleResourceLoaderBridge::AllowFileOverHTTP( |
| 1045 const std::string& file_path_template, const GURL& http_prefix) { | 1043 const std::string& file_path_template, const GURL& http_prefix) { |
| 1046 DCHECK(!file_path_template.empty()); | 1044 DCHECK(!file_path_template.empty()); |
| 1047 DCHECK(http_prefix.is_valid() && | 1045 DCHECK(http_prefix.is_valid() && |
| 1048 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1046 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
| 1049 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1047 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
| 1050 http_prefix); | 1048 http_prefix); |
| 1051 } | 1049 } |
| OLD | NEW |