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

Side by Side Diff: services/device/time_zone_monitor/time_zone_monitor_linux.cc

Issue 2690963002: [DeviceService] Move //device/time_zone_monitor to //services/device (Closed)
Patch Set: Enable device service to register JNI Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 "device/time_zone_monitor/time_zone_monitor.h" 5 #include "services/device/time_zone_monitor/time_zone_monitor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_path_watcher.h" 15 #include "base/files/file_path_watcher.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 DCHECK(main_task_runner_->RunsTasksOnCurrentThread()); 69 DCHECK(main_task_runner_->RunsTasksOnCurrentThread());
70 owner_ = NULL; 70 owner_ = NULL;
71 file_task_runner_->PostTask( 71 file_task_runner_->PostTask(
72 FROM_HERE, 72 FROM_HERE,
73 base::Bind(&TimeZoneMonitorLinuxImpl::StopWatchingOnFileThread, this)); 73 base::Bind(&TimeZoneMonitorLinuxImpl::StopWatchingOnFileThread, this));
74 } 74 }
75 75
76 private: 76 private:
77 friend class base::RefCountedThreadSafe<TimeZoneMonitorLinuxImpl>; 77 friend class base::RefCountedThreadSafe<TimeZoneMonitorLinuxImpl>;
78 78
79 ~TimeZoneMonitorLinuxImpl() { 79 ~TimeZoneMonitorLinuxImpl() { DCHECK(!owner_); }
80 DCHECK(!owner_);
81 }
82 80
83 void StartWatchingOnFileThread() { 81 void StartWatchingOnFileThread() {
84 base::ThreadRestrictions::AssertIOAllowed(); 82 base::ThreadRestrictions::AssertIOAllowed();
85 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); 83 DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
86 84
87 // There is no true standard for where time zone information is actually 85 // There is no true standard for where time zone information is actually
88 // stored. glibc uses /etc/localtime, uClibc uses /etc/TZ, and some older 86 // stored. glibc uses /etc/localtime, uClibc uses /etc/TZ, and some older
89 // systems store the name of the time zone file within /usr/share/zoneinfo 87 // systems store the name of the time zone file within /usr/share/zoneinfo
90 // in /etc/timezone. Different libraries and custom builds may mean that 88 // in /etc/timezone. Different libraries and custom builds may mean that
91 // still more paths are used. Just watch all three of these paths, because 89 // still more paths are used. Just watch all three of these paths, because
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // static 162 // static
165 std::unique_ptr<TimeZoneMonitor> TimeZoneMonitor::Create( 163 std::unique_ptr<TimeZoneMonitor> TimeZoneMonitor::Create(
166 scoped_refptr<base::SequencedTaskRunner> file_task_runner) { 164 scoped_refptr<base::SequencedTaskRunner> file_task_runner) {
167 return std::unique_ptr<TimeZoneMonitor>( 165 return std::unique_ptr<TimeZoneMonitor>(
168 new TimeZoneMonitorLinux(file_task_runner)); 166 new TimeZoneMonitorLinux(file_task_runner));
169 } 167 }
170 168
171 } // namespace device 169 } // namespace device
172 170
173 #endif // !OS_CHROMEOS 171 #endif // !OS_CHROMEOS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698