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 "data_file_browser_cld_data_provider.h" | 5 #include "data_file_browser_cld_data_provider.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // Guards g_cached_filepath | 33 // Guards g_cached_filepath |
34 base::LazyInstance<base::Lock> g_file_lock_; | 34 base::LazyInstance<base::Lock> g_file_lock_; |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 namespace translate { | 37 namespace translate { |
38 | 38 |
39 // Implementation of the static factory method from BrowserCldDataProvider, | 39 // Implementation of the static factory method from BrowserCldDataProvider, |
40 // hooking up this specific implementation for all of Chromium. | 40 // hooking up this specific implementation for all of Chromium. |
41 BrowserCldDataProvider* CreateBrowserCldDataProviderFor( | 41 BrowserCldDataProvider* CreateBrowserCldDataProviderFor( |
42 content::WebContents* web_contents) { | 42 content::WebContents* web_contents) { |
| 43 VLOG(1) << "Creating DataFileBrowserCldDataProvider"; |
43 return new DataFileBrowserCldDataProvider(web_contents); | 44 return new DataFileBrowserCldDataProvider(web_contents); |
44 } | 45 } |
45 | 46 |
46 void DataFileBrowserCldDataProvider::SetCldDataFilePath( | 47 void DataFileBrowserCldDataProvider::SetCldDataFilePath( |
47 const base::FilePath& path) { | 48 const base::FilePath& path) { |
48 VLOG(1) << "Setting CLD data file path to: " << path.value(); | 49 VLOG(1) << "Setting CLD data file path to: " << path.value(); |
49 base::AutoLock lock(g_file_lock_.Get()); | 50 base::AutoLock lock(g_file_lock_.Get()); |
50 if (g_cached_filepath == path) | 51 if (g_cached_filepath == path) |
51 return; // no change necessary | 52 return; // no change necessary |
52 g_cached_filepath = path; | 53 g_cached_filepath = path; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // Else, this request has taken care of it all. Cache all info. | 235 // Else, this request has taken care of it all. Cache all info. |
235 VLOG(1) << "Caching CLD data file information."; | 236 VLOG(1) << "Caching CLD data file information."; |
236 g_cached_file = file.release(); | 237 g_cached_file = file.release(); |
237 g_cached_data_offset = data_offset; | 238 g_cached_data_offset = data_offset; |
238 g_cached_data_length = data_length; | 239 g_cached_data_length = data_length; |
239 } | 240 } |
240 } | 241 } |
241 } | 242 } |
242 | 243 |
243 } // namespace translate | 244 } // namespace translate |
OLD | NEW |