| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/web_resource/web_resource_service.h" | 4 #include "chrome/browser/web_resource/web_resource_service.h" |
| 5 | 5 |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 void Start() { | 105 void Start() { |
| 106 AddRef(); // balanced in Cleanup. | 106 AddRef(); // balanced in Cleanup. |
| 107 | 107 |
| 108 // If we don't have a resource_dispatcher_host_, assume we're in | 108 // If we don't have a resource_dispatcher_host_, assume we're in |
| 109 // a test and run the unpacker directly in-process. | 109 // a test and run the unpacker directly in-process. |
| 110 bool use_utility_process = | 110 bool use_utility_process = |
| 111 web_resource_service_->resource_dispatcher_host_ != NULL && | 111 web_resource_service_->resource_dispatcher_host_ != NULL && |
| 112 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 112 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
| 113 | 113 |
| 114 #if defined(OS_POSIX) | 114 #if defined(OS_LINUX) |
| 115 // TODO(port): Don't use a utility process on linux (crbug.com/22703) or | 115 // TODO(port): Don't use a utility process on linux (crbug.com/22703). |
| 116 // MacOS (crbug.com/8102) until problems related to autoupdate are fixed. | |
| 117 use_utility_process = false; | 116 use_utility_process = false; |
| 118 #endif | 117 #endif |
| 119 | 118 |
| 120 if (use_utility_process) { | 119 if (use_utility_process) { |
| 121 ChromeThread::ID thread_id; | 120 ChromeThread::ID thread_id; |
| 122 CHECK(ChromeThread::GetCurrentThreadIdentifier(&thread_id)); | 121 CHECK(ChromeThread::GetCurrentThreadIdentifier(&thread_id)); |
| 123 ChromeThread::PostTask( | 122 ChromeThread::PostTask( |
| 124 ChromeThread::IO, FROM_HERE, | 123 ChromeThread::IO, FROM_HERE, |
| 125 NewRunnableMethod(this, &UnpackerClient::StartProcessOnIOThread, | 124 NewRunnableMethod(this, &UnpackerClient::StartProcessOnIOThread, |
| 126 web_resource_service_->resource_dispatcher_host_, | 125 web_resource_service_->resource_dispatcher_host_, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 294 |
| 296 void WebResourceService::UpdateResourceCache(const std::string& json_data) { | 295 void WebResourceService::UpdateResourceCache(const std::string& json_data) { |
| 297 UnpackerClient* client = new UnpackerClient(this, json_data); | 296 UnpackerClient* client = new UnpackerClient(this, json_data); |
| 298 client->Start(); | 297 client->Start(); |
| 299 | 298 |
| 300 // Update resource server and cache update time in preferences. | 299 // Update resource server and cache update time in preferences. |
| 301 prefs_->SetString(prefs::kNTPTipsCacheUpdate, | 300 prefs_->SetString(prefs::kNTPTipsCacheUpdate, |
| 302 DoubleToWString(base::Time::Now().ToDoubleT())); | 301 DoubleToWString(base::Time::Now().ToDoubleT())); |
| 303 prefs_->SetString(prefs::kNTPTipsServer, web_resource_server_); | 302 prefs_->SetString(prefs::kNTPTipsServer, web_resource_server_); |
| 304 } | 303 } |
| OLD | NEW |