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

Side by Side Diff: chrome/service/net/service_network_change_notifier_thread.cc

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/service/net/service_network_change_notifier_thread.h"
6
7 #include "base/logging.h"
8 #include "base/message_loop.h"
9 #include "net/base/network_change_notifier.h"
10
11 ServiceNetworkChangeNotifierThread::ServiceNetworkChangeNotifierThread(
12 MessageLoop* io_thread_message_loop)
13 : io_thread_message_loop_(io_thread_message_loop) {
14 DCHECK(io_thread_message_loop_);
15 }
16
17 ServiceNetworkChangeNotifierThread::~ServiceNetworkChangeNotifierThread() {
18 io_thread_message_loop_->DeleteSoon(FROM_HERE,
19 network_change_notifier_.release());
20 }
21
22 void ServiceNetworkChangeNotifierThread::Initialize() {
23 io_thread_message_loop_->PostTask(
24 FROM_HERE,
25 NewRunnableMethod(
26 this,
27 &ServiceNetworkChangeNotifierThread::CreateNetworkChangeNotifier));
28 }
29
30 MessageLoop* ServiceNetworkChangeNotifierThread::GetMessageLoop() const {
31 DCHECK(io_thread_message_loop_);
32 return io_thread_message_loop_;
33 }
34
35 net::NetworkChangeNotifier*
36 ServiceNetworkChangeNotifierThread::GetNetworkChangeNotifier() const {
37 DCHECK(MessageLoop::current() == io_thread_message_loop_);
38 return network_change_notifier_.get();
39 }
40
41 void ServiceNetworkChangeNotifierThread::CreateNetworkChangeNotifier() {
42 DCHECK(MessageLoop::current() == io_thread_message_loop_);
43 network_change_notifier_.reset(
44 net::NetworkChangeNotifier::CreateDefaultNetworkChangeNotifier());
45 }
46
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698