Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2200)

Unified Diff: chrome/browser/component_updater/cld_component_installer.cc

Issue 333603002: Modularize Compact Language Detector 2 (CLD2) data sources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge https://codereview.chromium.org/326383005 Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/component_updater/cld_component_installer.cc
diff --git a/chrome/browser/component_updater/cld_component_installer.cc b/chrome/browser/component_updater/cld_component_installer.cc
index 5028c5bb2bd25dd796c890cce57a863659ab1d0c..a3e62ac15f3ee3895196399b1dba75e5723b3503 100644
--- a/chrome/browser/component_updater/cld_component_installer.cc
+++ b/chrome/browser/component_updater/cld_component_installer.cc
@@ -14,8 +14,8 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
+#include "components/translate/content/browser/data_file_browser_cld_data_provider.h"
#include "content/public/browser/browser_thread.h"
#include "net/ssl/ssl_config_service.h"
@@ -23,15 +23,12 @@ using component_updater::ComponentUpdateService;
using content::BrowserThread;
namespace {
-
-// Once we have acquired a valid file from the component installer, we need to
-// make the path available to other parts of the system such as the
-// translation libraries. We create a global to hold onto the path, and a
-// lock to guard it. See GetLatestCldDataFile(...) for more info.
-base::LazyInstance<base::Lock> cld_file_lock = LAZY_INSTANCE_INITIALIZER;
-base::LazyInstance<base::FilePath> cld_file = LAZY_INSTANCE_INITIALIZER;
-
-}
+// TODO(andrewhayden): Make the data file path into a gyp/gn define
+// If you change this, also update component_cld_data_harness.cc
+// and cld_component_installer_unittest.cc accordingly!
+const base::FilePath::CharType kCldDataFileName[] =
+ FILE_PATH_LITERAL("cld2_data.bin");
+} // namespace
namespace component_updater {
@@ -66,7 +63,7 @@ base::FilePath CldComponentInstallerTraits::GetInstalledPath(
// NB: This may change when 64-bit is officially supported.
return base.Append(FILE_PATH_LITERAL("_platform_specific"))
.Append(FILE_PATH_LITERAL("all"))
- .Append(chrome::kCLDDataFilename);
+ .Append(kCldDataFileName);
}
void CldComponentInstallerTraits::ComponentReady(
@@ -117,14 +114,7 @@ void RegisterCldComponent(ComponentUpdateService* cus) {
void CldComponentInstallerTraits::SetLatestCldDataFile(
const base::FilePath& path) {
VLOG(1) << "Setting CLD data file location: " << path.value();
- base::AutoLock lock(cld_file_lock.Get());
- cld_file.Get() = path;
-}
-
-base::FilePath GetLatestCldDataFile() {
- base::AutoLock lock(cld_file_lock.Get());
- // cld_file is an empty path by default, meaning "file not available yet".
- return cld_file.Get();
+ translate::DataFileBrowserCldDataProvider::SetCldDataFilePath(path);
}
} // namespace component_updater

Powered by Google App Engine
This is Rietveld 408576698