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

Side by Side Diff: base/files/file_path_watcher_win.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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 | « base/base_unittests.isolate ('k') | base/files/important_file_writer.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/files/file_path_watcher.h" 5 #include "base/files/file_path_watcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.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/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/message_loop/message_loop_proxy.h" 13 #include "base/message_loop/message_loop_proxy.h"
14 #include "base/profiler/scoped_tracker.h"
15 #include "base/time/time.h" 14 #include "base/time/time.h"
16 #include "base/win/object_watcher.h" 15 #include "base/win/object_watcher.h"
17 16
18 namespace base { 17 namespace base {
19 18
20 namespace { 19 namespace {
21 20
22 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate, 21 class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate,
23 public base::win::ObjectWatcher::Delegate, 22 public base::win::ObjectWatcher::Delegate,
24 public MessageLoop::DestructionObserver { 23 public MessageLoop::DestructionObserver {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 MessageLoop::current()->RemoveDestructionObserver(this); 139 MessageLoop::current()->RemoveDestructionObserver(this);
141 callback_.Reset(); 140 callback_.Reset();
142 } 141 }
143 } 142 }
144 143
145 void FilePathWatcherImpl::WillDestroyCurrentMessageLoop() { 144 void FilePathWatcherImpl::WillDestroyCurrentMessageLoop() {
146 CancelOnMessageLoopThread(); 145 CancelOnMessageLoopThread();
147 } 146 }
148 147
149 void FilePathWatcherImpl::OnObjectSignaled(HANDLE object) { 148 void FilePathWatcherImpl::OnObjectSignaled(HANDLE object) {
150 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is fixed.
151 tracked_objects::ScopedTracker tracking_profile(
152 FROM_HERE_WITH_EXPLICIT_FUNCTION(
153 "418183 FilePathWatcherImpl::OnObjectSignaled"));
154
155 DCHECK(object == handle_); 149 DCHECK(object == handle_);
156 // Make sure we stay alive through the body of this function. 150 // Make sure we stay alive through the body of this function.
157 scoped_refptr<FilePathWatcherImpl> keep_alive(this); 151 scoped_refptr<FilePathWatcherImpl> keep_alive(this);
158 152
159 if (!UpdateWatch()) { 153 if (!UpdateWatch()) {
160 callback_.Run(target_, true /* error */); 154 callback_.Run(target_, true /* error */);
161 return; 155 return;
162 } 156 }
163 157
164 // Check whether the event applies to |target_| and notify the callback. 158 // Check whether the event applies to |target_| and notify the callback.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 handle_ = INVALID_HANDLE_VALUE; 292 handle_ = INVALID_HANDLE_VALUE;
299 } 293 }
300 294
301 } // namespace 295 } // namespace
302 296
303 FilePathWatcher::FilePathWatcher() { 297 FilePathWatcher::FilePathWatcher() {
304 impl_ = new FilePathWatcherImpl(); 298 impl_ = new FilePathWatcherImpl();
305 } 299 }
306 300
307 } // namespace base 301 } // namespace base
OLDNEW
« no previous file with comments | « base/base_unittests.isolate ('k') | base/files/important_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698