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

Unified Diff: device/time_zone_monitor/time_zone_monitor_linux.cc

Issue 2443803002: Remove stl_util's deletion function use from device/. (Closed)
Patch Set: _ Created 4 years, 2 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
« no previous file with comments | « device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/time_zone_monitor/time_zone_monitor_linux.cc
diff --git a/device/time_zone_monitor/time_zone_monitor_linux.cc b/device/time_zone_monitor/time_zone_monitor_linux.cc
index 6d560dd76d648106b3ac78ae951206ad4475dac7..9aee0b2b4388fb1cdc3f202152528d500dbda93c 100644
--- a/device/time_zone_monitor/time_zone_monitor_linux.cc
+++ b/device/time_zone_monitor/time_zone_monitor_linux.cc
@@ -7,12 +7,14 @@
#include <stddef.h>
#include <stdlib.h>
+#include <memory>
#include <vector>
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
#include "base/stl_util.h"
@@ -54,7 +56,6 @@ class TimeZoneMonitorLinuxImpl
TimeZoneMonitorLinux* owner,
scoped_refptr<base::SequencedTaskRunner> file_task_runner)
: base::RefCountedThreadSafe<TimeZoneMonitorLinuxImpl>(),
- file_path_watchers_(),
main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
file_task_runner_(file_task_runner),
owner_(owner) {
@@ -77,7 +78,6 @@ class TimeZoneMonitorLinuxImpl
~TimeZoneMonitorLinuxImpl() {
DCHECK(!owner_);
- base::STLDeleteElements(&file_path_watchers_);
}
void StartWatchingOnFileThread() {
@@ -96,7 +96,7 @@ class TimeZoneMonitorLinuxImpl
};
for (size_t index = 0; index < arraysize(kFilesToWatch); ++index) {
- file_path_watchers_.push_back(new base::FilePathWatcher());
+ file_path_watchers_.push_back(base::MakeUnique<base::FilePathWatcher>());
file_path_watchers_.back()->Watch(
base::FilePath(kFilesToWatch[index]), false,
base::Bind(&TimeZoneMonitorLinuxImpl::OnTimeZoneFileChanged, this));
@@ -105,7 +105,7 @@ class TimeZoneMonitorLinuxImpl
void StopWatchingOnFileThread() {
DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
- base::STLDeleteElements(&file_path_watchers_);
+ file_path_watchers_.clear();
}
void OnTimeZoneFileChanged(const base::FilePath& path, bool error) {
@@ -123,7 +123,7 @@ class TimeZoneMonitorLinuxImpl
}
}
- std::vector<base::FilePathWatcher*> file_path_watchers_;
+ std::vector<std::unique_ptr<base::FilePathWatcher>> file_path_watchers_;
scoped_refptr<base::SequencedTaskRunner> main_task_runner_;
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
« no previous file with comments | « device/bluetooth/dbus/fake_bluetooth_media_transport_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698