| OLD | NEW |
| 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/dns/dns_config_service_win.h" | 5 #include "net/dns/dns_config_service_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 const FilePath path_; | 649 const FilePath path_; |
| 650 DnsConfigServiceWin* service_; | 650 DnsConfigServiceWin* service_; |
| 651 // Written in DoWork, read in OnWorkFinished, no locking necessary. | 651 // Written in DoWork, read in OnWorkFinished, no locking necessary. |
| 652 DnsHosts hosts_; | 652 DnsHosts hosts_; |
| 653 bool success_; | 653 bool success_; |
| 654 | 654 |
| 655 DISALLOW_COPY_AND_ASSIGN(HostsReader); | 655 DISALLOW_COPY_AND_ASSIGN(HostsReader); |
| 656 }; | 656 }; |
| 657 | 657 |
| 658 DnsConfigServiceWin::DnsConfigServiceWin() | 658 DnsConfigServiceWin::DnsConfigServiceWin() |
| 659 : watcher_(new Watcher(this)), | 659 : config_reader_(new ConfigReader(this)), |
| 660 config_reader_(new ConfigReader(this)), | |
| 661 hosts_reader_(new HostsReader(this)) {} | 660 hosts_reader_(new HostsReader(this)) {} |
| 662 | 661 |
| 663 DnsConfigServiceWin::~DnsConfigServiceWin() { | 662 DnsConfigServiceWin::~DnsConfigServiceWin() { |
| 664 config_reader_->Cancel(); | 663 config_reader_->Cancel(); |
| 665 hosts_reader_->Cancel(); | 664 hosts_reader_->Cancel(); |
| 666 } | 665 } |
| 667 | 666 |
| 668 void DnsConfigServiceWin::ReadNow() { | 667 void DnsConfigServiceWin::ReadNow() { |
| 669 config_reader_->WorkNow(); | 668 config_reader_->WorkNow(); |
| 670 hosts_reader_->WorkNow(); | 669 hosts_reader_->WorkNow(); |
| 671 } | 670 } |
| 672 | 671 |
| 673 bool DnsConfigServiceWin::StartWatching() { | 672 bool DnsConfigServiceWin::StartWatching() { |
| 674 // TODO(szym): re-start watcher if that makes sense. http://crbug.com/116139 | 673 // TODO(szym): re-start watcher if that makes sense. http://crbug.com/116139 |
| 674 watcher_.reset(new Watcher(this)); |
| 675 return watcher_->Watch(); | 675 return watcher_->Watch(); |
| 676 } | 676 } |
| 677 | 677 |
| 678 void DnsConfigServiceWin::OnConfigChanged(bool succeeded) { | 678 void DnsConfigServiceWin::OnConfigChanged(bool succeeded) { |
| 679 InvalidateConfig(); | 679 InvalidateConfig(); |
| 680 if (succeeded) { | 680 if (succeeded) { |
| 681 config_reader_->WorkNow(); | 681 config_reader_->WorkNow(); |
| 682 } else { | 682 } else { |
| 683 LOG(ERROR) << "DNS config watch failed."; | 683 LOG(ERROR) << "DNS config watch failed."; |
| 684 set_watch_failed(true); | 684 set_watch_failed(true); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 697 | 697 |
| 698 } // namespace internal | 698 } // namespace internal |
| 699 | 699 |
| 700 // static | 700 // static |
| 701 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { | 701 scoped_ptr<DnsConfigService> DnsConfigService::CreateSystemService() { |
| 702 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); | 702 return scoped_ptr<DnsConfigService>(new internal::DnsConfigServiceWin()); |
| 703 } | 703 } |
| 704 | 704 |
| 705 } // namespace net | 705 } // namespace net |
| 706 | 706 |
| OLD | NEW |