| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ios/crnet/crnet_environment.h" | 5 #include "ios/crnet/crnet_environment.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return getter_.get(); | 132 return getter_.get(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 scoped_refptr<net::URLRequestContextGetter> getter_; | 135 scoped_refptr<net::URLRequestContextGetter> getter_; |
| 136 base::mac::ScopedBlock<RequestFilterBlock> filter_; | 136 base::mac::ScopedBlock<RequestFilterBlock> filter_; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 void CrNetEnvironment::PostToNetworkThread( | 139 void CrNetEnvironment::PostToNetworkThread( |
| 140 const tracked_objects::Location& from_here, | 140 const tracked_objects::Location& from_here, |
| 141 const base::Closure& task) { | 141 const base::Closure& task) { |
| 142 network_io_thread_->message_loop()->PostTask(from_here, task); | 142 network_io_thread_->task_runner()->PostTask(from_here, task); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void CrNetEnvironment::PostToFileUserBlockingThread( | 145 void CrNetEnvironment::PostToFileUserBlockingThread( |
| 146 const tracked_objects::Location& from_here, | 146 const tracked_objects::Location& from_here, |
| 147 const base::Closure& task) { | 147 const base::Closure& task) { |
| 148 file_user_blocking_thread_->message_loop()->PostTask(from_here, task); | 148 file_user_blocking_thread_->task_runner()->PostTask(from_here, task); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // static | 151 // static |
| 152 void CrNetEnvironment::Initialize() { | 152 void CrNetEnvironment::Initialize() { |
| 153 DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); | 153 DCHECK_EQ([NSThread currentThread], [NSThread mainThread]); |
| 154 if (!g_at_exit_) | 154 if (!g_at_exit_) |
| 155 g_at_exit_ = new base::AtExitManager; | 155 g_at_exit_ = new base::AtExitManager; |
| 156 | 156 |
| 157 // Change the framework bundle to the bundle that contain CrNet framework. | 157 // Change the framework bundle to the bundle that contain CrNet framework. |
| 158 // By default the framework bundle is set equal to the main (app) bundle. | 158 // By default the framework bundle is set equal to the main (app) bundle. |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 490 |
| 491 return user_agent_settings->GetUserAgent(); | 491 return user_agent_settings->GetUserAgent(); |
| 492 } | 492 } |
| 493 | 493 |
| 494 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { | 494 void CrNetEnvironment::ClearCache(ClearCacheCallback callback) { |
| 495 PostToNetworkThread( | 495 PostToNetworkThread( |
| 496 FROM_HERE, | 496 FROM_HERE, |
| 497 base::Bind(&net::ClearHttpCache, main_context_getter_, | 497 base::Bind(&net::ClearHttpCache, main_context_getter_, |
| 498 network_io_thread_->task_runner(), base::BindBlock(callback))); | 498 network_io_thread_->task_runner(), base::BindBlock(callback))); |
| 499 } | 499 } |
| OLD | NEW |