| 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 "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // Set up an empty default cache, with default size. | 321 // Set up an empty default cache, with default size. |
| 322 // TODO(droger): If the NSURLCache is to be used, its size should most | 322 // TODO(droger): If the NSURLCache is to be used, its size should most |
| 323 // likely be changed. On an iPod2 with iOS4, the default size is 512k. | 323 // likely be changed. On an iPod2 with iOS4, the default size is 512k. |
| 324 [NSURLCache setSharedURLCache:[[[NSURLCache alloc] init] autorelease]]; | 324 [NSURLCache setSharedURLCache:[[[NSURLCache alloc] init] autorelease]]; |
| 325 [NSURLProtocol unregisterClass:[CRNPauseableHTTPProtocolHandler class]]; | 325 [NSURLProtocol unregisterClass:[CRNPauseableHTTPProtocolHandler class]]; |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 void CrNetEnvironment::ConfigureSdchOnNetworkThread() { | 329 void CrNetEnvironment::ConfigureSdchOnNetworkThread() { |
| 330 DCHECK(base::MessageLoop::current() == network_io_thread_->message_loop()); | 330 DCHECK(base::MessageLoop::current() == network_io_thread_->message_loop()); |
| 331 net::URLRequestContext* context = |
| 332 main_context_getter_->GetURLRequestContext(); |
| 331 | 333 |
| 332 if (!sdch_enabled_) { | 334 if (!sdch_enabled_) { |
| 333 net::SdchManager::EnableSdchSupport(false); | 335 DCHECK_EQ(static_cast<net::SdchManager*>(nullptr), context->sdch_manager()); |
| 334 return; | 336 return; |
| 335 } | 337 } |
| 336 | 338 |
| 337 sdch_manager_.reset(new net::SdchManager()); | 339 sdch_manager_.reset(new net::SdchManager()); |
| 338 net::URLRequestContext* context = | |
| 339 main_context_getter_->GetURLRequestContext(); | |
| 340 sdch_owner_.reset(new net::SdchOwner(sdch_manager_.get(), context)); | 340 sdch_owner_.reset(new net::SdchOwner(sdch_manager_.get(), context)); |
| 341 if (!sdch_pref_store_filename_.empty()) { | 341 if (!sdch_pref_store_filename_.empty()) { |
| 342 base::FilePath path(sdch_pref_store_filename_); | 342 base::FilePath path(sdch_pref_store_filename_); |
| 343 pref_store_worker_pool_ = file_user_blocking_thread_->task_runner(); | 343 pref_store_worker_pool_ = file_user_blocking_thread_->task_runner(); |
| 344 net_pref_store_ = new JsonPrefStore( | 344 net_pref_store_ = new JsonPrefStore( |
| 345 path, | 345 path, |
| 346 pref_store_worker_pool_.get(), | 346 pref_store_worker_pool_.get(), |
| 347 scoped_ptr<PrefFilter>()); | 347 scoped_ptr<PrefFilter>()); |
| 348 net_pref_store_->ReadPrefsAsync(nullptr); | 348 net_pref_store_->ReadPrefsAsync(nullptr); |
| 349 sdch_owner_->EnablePersistentStorage(net_pref_store_.get()); | 349 sdch_owner_->EnablePersistentStorage(net_pref_store_.get()); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 if (backend) | 494 if (backend) |
| 495 backend->DoomAllEntries(client_callback); | 495 backend->DoomAllEntries(client_callback); |
| 496 }); | 496 }); |
| 497 int rc = cache->GetBackend(&backend, doom_callback); | 497 int rc = cache->GetBackend(&backend, doom_callback); |
| 498 if (rc != net::ERR_IO_PENDING) { | 498 if (rc != net::ERR_IO_PENDING) { |
| 499 // GetBackend doesn't call the callback if it completes synchronously, so | 499 // GetBackend doesn't call the callback if it completes synchronously, so |
| 500 // call it directly here. | 500 // call it directly here. |
| 501 doom_callback.Run(rc); | 501 doom_callback.Run(rc); |
| 502 } | 502 } |
| 503 } | 503 } |
| OLD | NEW |