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

Side by Side Diff: net/base/network_config_watcher_mac.cc

Issue 10029001: Update use of TimeDelta in net/*. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 | « net/base/network_change_notifier_win.cc ('k') | net/dns/serial_worker.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 "net/base/network_config_watcher_mac.h" 5 #include "net/base/network_config_watcher_mac.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 void NetworkConfigWatcherMacThread::Init() { 65 void NetworkConfigWatcherMacThread::Init() {
66 // Disallow IO to make sure NetworkConfigWatcherMacThread's helper thread does 66 // Disallow IO to make sure NetworkConfigWatcherMacThread's helper thread does
67 // not perform blocking operations. 67 // not perform blocking operations.
68 base::ThreadRestrictions::SetIOAllowed(false); 68 base::ThreadRestrictions::SetIOAllowed(false);
69 69
70 delegate_->Init(); 70 delegate_->Init();
71 71
72 // TODO(willchan): Look to see if there's a better signal for when it's ok to 72 // TODO(willchan): Look to see if there's a better signal for when it's ok to
73 // initialize this, rather than just delaying it by a fixed time. 73 // initialize this, rather than just delaying it by a fixed time.
74 const int kInitializationDelayMS = 1000; 74 const base::TimeDelta kInitializationDelay = base::TimeDelta::FromSeconds(1);
75 message_loop()->PostDelayedTask( 75 message_loop()->PostDelayedTask(
76 FROM_HERE, 76 FROM_HERE,
77 base::Bind(&NetworkConfigWatcherMacThread::InitNotifications, 77 base::Bind(&NetworkConfigWatcherMacThread::InitNotifications,
78 weak_factory_.GetWeakPtr()), 78 weak_factory_.GetWeakPtr()),
79 kInitializationDelayMS); 79 kInitializationDelay);
80 } 80 }
81 81
82 void NetworkConfigWatcherMacThread::CleanUp() { 82 void NetworkConfigWatcherMacThread::CleanUp() {
83 if (!run_loop_source_.get()) 83 if (!run_loop_source_.get())
84 return; 84 return;
85 85
86 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), run_loop_source_.get(), 86 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), run_loop_source_.get(),
87 kCFRunLoopCommonModes); 87 kCFRunLoopCommonModes);
88 run_loop_source_.reset(); 88 run_loop_source_.reset();
89 } 89 }
(...skipping 26 matching lines...) Expand all
116 // We create this notifier thread because the notification implementation 116 // We create this notifier thread because the notification implementation
117 // needs a thread with a CFRunLoop, and there's no guarantee that 117 // needs a thread with a CFRunLoop, and there's no guarantee that
118 // MessageLoop::current() meets that criterion. 118 // MessageLoop::current() meets that criterion.
119 base::Thread::Options thread_options(MessageLoop::TYPE_UI, 0); 119 base::Thread::Options thread_options(MessageLoop::TYPE_UI, 0);
120 notifier_thread_->StartWithOptions(thread_options); 120 notifier_thread_->StartWithOptions(thread_options);
121 } 121 }
122 122
123 NetworkConfigWatcherMac::~NetworkConfigWatcherMac() {} 123 NetworkConfigWatcherMac::~NetworkConfigWatcherMac() {}
124 124
125 } // namespace net 125 } // namespace net
OLDNEW
« no previous file with comments | « net/base/network_change_notifier_win.cc ('k') | net/dns/serial_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698