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

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

Issue 223143006: Make necessary changes for chromecast build as chromecast has it own implementation of NetworkChang… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a check failure when we don't yet have a NetworkChangeNotifierFactory for chromecast build Created 6 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 | « no previous file | net/net.gyp » ('j') | net/proxy/proxy_service.cc » ('J')
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_change_notifier.h" 5 #include "net/base/network_change_notifier.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/synchronization/lock.h" 8 #include "base/synchronization/lock.h"
9 #include "base/threading/thread_checker.h" 9 #include "base/threading/thread_checker.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
12 #include "net/base/network_change_notifier_factory.h" 12 #include "net/base/network_change_notifier_factory.h"
13 #include "net/dns/dns_config_service.h" 13 #include "net/dns/dns_config_service.h"
14 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 #if defined(OS_WIN) 17 #if defined(OS_WIN)
18 #include "net/base/network_change_notifier_win.h" 18 #include "net/base/network_change_notifier_win.h"
19 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) 19 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(CHROMECAST_BUILD)
darin (slow to review) 2014/04/14 05:03:29 is it actually problematic to include this header?
lcwu1 2014/04/15 06:24:42 No, it doesn't cause any problem if we include the
20 #include "net/base/network_change_notifier_linux.h" 20 #include "net/base/network_change_notifier_linux.h"
21 #elif defined(OS_MACOSX) 21 #elif defined(OS_MACOSX)
22 #include "net/base/network_change_notifier_mac.h" 22 #include "net/base/network_change_notifier_mac.h"
23 #endif 23 #endif
24 24
25 namespace net { 25 namespace net {
26 26
27 namespace { 27 namespace {
28 28
29 // The actual singleton notifier. The class contract forbids usage of the API 29 // The actual singleton notifier. The class contract forbids usage of the API
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 NetworkChangeNotifierFactory* factory) { 473 NetworkChangeNotifierFactory* factory) {
474 CHECK(!g_network_change_notifier_factory); 474 CHECK(!g_network_change_notifier_factory);
475 g_network_change_notifier_factory = factory; 475 g_network_change_notifier_factory = factory;
476 } 476 }
477 477
478 // static 478 // static
479 NetworkChangeNotifier* NetworkChangeNotifier::Create() { 479 NetworkChangeNotifier* NetworkChangeNotifier::Create() {
480 if (g_network_change_notifier_factory) 480 if (g_network_change_notifier_factory)
481 return g_network_change_notifier_factory->CreateInstance(); 481 return g_network_change_notifier_factory->CreateInstance();
482 482
483 #if defined(OS_WIN) 483 #if defined(OS_WIN)
darin (slow to review) 2014/04/14 05:03:29 we could eliminate #ifdefs here by having separate
lcwu1 2014/04/15 06:24:42 Sure, let me try to re-factor the code to do that.
484 NetworkChangeNotifierWin* network_change_notifier = 484 NetworkChangeNotifierWin* network_change_notifier =
485 new NetworkChangeNotifierWin(); 485 new NetworkChangeNotifierWin();
486 network_change_notifier->WatchForAddressChange(); 486 network_change_notifier->WatchForAddressChange();
487 return network_change_notifier; 487 return network_change_notifier;
488 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) 488 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID)
489 // ChromeOS and Android builds MUST use their own class factory. 489 // ChromeOS, Android, and Chromecast builds MUST use their own class factory.
Ryan Sleevi 2014/04/14 21:28:43 This comment doesn't seem like it should be update
lcwu1 2014/04/15 06:24:42 Yes, this comment only makes sense in patch set 2.
490 #if !defined(OS_CHROMEOS) 490 #if !defined(OS_CHROMEOS)
491 // TODO(oshima): ash_shell do not have access to chromeos'es 491 // TODO(oshima): ash_shell do not have access to chromeos'es
492 // notifier yet. Re-enable this when chromeos'es notifier moved to 492 // notifier yet. Re-enable this when chromeos'es notifier moved to
493 // chromeos root directory. crbug.com/119298. 493 // chromeos root directory. crbug.com/119298.
494 CHECK(false); 494 CHECK(false);
495 #endif 495 #endif
496 return NULL; 496 return NULL;
497 #elif defined(CHROMECAST_BUILD)
darin (slow to review) 2014/04/14 04:48:00 The comment that Chromecast MUST use its own class
Ryan Sleevi 2014/04/14 21:28:43 Apologies that I wasn't clearer, this is what I wa
lcwu1 2014/04/15 06:24:42 Yes, agreed. The reason why I didn't have a CHECK
498 return NULL;
497 #elif defined(OS_LINUX) 499 #elif defined(OS_LINUX)
498 return NetworkChangeNotifierLinux::Create(); 500 return NetworkChangeNotifierLinux::Create();
499 #elif defined(OS_MACOSX) 501 #elif defined(OS_MACOSX)
500 return new NetworkChangeNotifierMac(); 502 return new NetworkChangeNotifierMac();
501 #else 503 #else
502 NOTIMPLEMENTED(); 504 NOTIMPLEMENTED();
503 return NULL; 505 return NULL;
504 #endif 506 #endif
505 } 507 }
506 508
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 DCHECK(g_network_change_notifier); 744 DCHECK(g_network_change_notifier);
743 g_network_change_notifier = NULL; 745 g_network_change_notifier = NULL;
744 } 746 }
745 747
746 NetworkChangeNotifier::DisableForTest::~DisableForTest() { 748 NetworkChangeNotifier::DisableForTest::~DisableForTest() {
747 DCHECK(!g_network_change_notifier); 749 DCHECK(!g_network_change_notifier);
748 g_network_change_notifier = network_change_notifier_; 750 g_network_change_notifier = network_change_notifier_;
749 } 751 }
750 752
751 } // namespace net 753 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/net.gyp » ('j') | net/proxy/proxy_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698