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

Side by Side Diff: remoting/host/config_file_watcher.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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
« no previous file with comments | « remoting/host/clipboard_x11.cc ('k') | remoting/host/config_file_watcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/host/config_file_watcher.h" 5 #include "remoting/host/config_file_watcher.h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
11 #include "base/files/file_path_watcher.h" 12 #include "base/files/file_path_watcher.h"
12 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 19
20 namespace remoting { 20 namespace remoting {
21 21
22 // The name of the command-line switch used to specify the host configuration 22 // The name of the command-line switch used to specify the host configuration
23 // file to use. 23 // file to use.
24 const char kHostConfigSwitchName[] = "host-config"; 24 const char kHostConfigSwitchName[] = "host-config";
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Called to notify the delegate of updates/errors in the main thread. 63 // Called to notify the delegate of updates/errors in the main thread.
64 void NotifyUpdate(const std::string& config); 64 void NotifyUpdate(const std::string& config);
65 void NotifyError(); 65 void NotifyError();
66 66
67 // Reads the configuration file and passes it to the delegate. 67 // Reads the configuration file and passes it to the delegate.
68 void ReloadConfig(); 68 void ReloadConfig();
69 69
70 std::string config_; 70 std::string config_;
71 base::FilePath config_path_; 71 base::FilePath config_path_;
72 72
73 scoped_ptr<base::DelayTimer> config_updated_timer_; 73 std::unique_ptr<base::DelayTimer> config_updated_timer_;
74 74
75 // Number of times an attempt to read the configuration file failed. 75 // Number of times an attempt to read the configuration file failed.
76 int retries_; 76 int retries_;
77 77
78 // Monitors the host configuration file. 78 // Monitors the host configuration file.
79 scoped_ptr<base::FilePathWatcher> config_watcher_; 79 std::unique_ptr<base::FilePathWatcher> config_watcher_;
80 80
81 ConfigWatcher::Delegate* delegate_; 81 ConfigWatcher::Delegate* delegate_;
82 82
83 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 83 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
84 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 84 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
85 85
86 base::WeakPtrFactory<ConfigFileWatcherImpl> weak_factory_; 86 base::WeakPtrFactory<ConfigFileWatcherImpl> weak_factory_;
87 87
88 DISALLOW_COPY_AND_ASSIGN(ConfigFileWatcherImpl); 88 DISALLOW_COPY_AND_ASSIGN(ConfigFileWatcherImpl);
89 }; 89 };
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 if (config_ != config) { 233 if (config_ != config) {
234 config_ = config; 234 config_ = config;
235 main_task_runner_->PostTask( 235 main_task_runner_->PostTask(
236 FROM_HERE, 236 FROM_HERE,
237 base::Bind(&ConfigFileWatcherImpl::NotifyUpdate, 237 base::Bind(&ConfigFileWatcherImpl::NotifyUpdate,
238 weak_factory_.GetWeakPtr(), config_)); 238 weak_factory_.GetWeakPtr(), config_));
239 } 239 }
240 } 240 }
241 241
242 } // namespace remoting 242 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/clipboard_x11.cc ('k') | remoting/host/config_file_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698