| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/local_discovery/service_discovery_client_mdns.h" | 5 #include "chrome/browser/local_discovery/service_discovery_client_mdns.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 17 #include "chrome/common/local_discovery/service_discovery_client_impl.h" | 17 #include "chrome/common/local_discovery/service_discovery_client_impl.h" |
| 18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 bool IsValid() override { | 160 bool IsValid() override { |
| 161 return !!implementation(); | 161 return !!implementation(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void OnMdnsDestroy() override { | 164 void OnMdnsDestroy() override { |
| 165 DeleteOnMdnsThread(implementation_.release()); | 165 DeleteOnMdnsThread(implementation_.release()); |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 protected: | 168 protected: |
| 169 void set_implementation(scoped_ptr<T> implementation) { | 169 void set_implementation(scoped_ptr<T> implementation) { |
| 170 implementation_ = implementation.Pass(); | 170 implementation_ = std::move(implementation); |
| 171 } | 171 } |
| 172 | 172 |
| 173 T* implementation() const { | 173 T* implementation() const { |
| 174 return implementation_.get(); | 174 return implementation_.get(); |
| 175 } | 175 } |
| 176 | 176 |
| 177 private: | 177 private: |
| 178 scoped_ptr<T> implementation_; | 178 scoped_ptr<T> implementation_; |
| 179 DISALLOW_COPY_AND_ASSIGN(ProxyBase); | 179 DISALLOW_COPY_AND_ASSIGN(ProxyBase); |
| 180 }; | 180 }; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 OnBeforeMdnsDestroy(); | 439 OnBeforeMdnsDestroy(); |
| 440 // After calling |Proxy::OnMdnsDestroy| all references to client_ and mdns_ | 440 // After calling |Proxy::OnMdnsDestroy| all references to client_ and mdns_ |
| 441 // should be destroyed. | 441 // should be destroyed. |
| 442 if (client_) | 442 if (client_) |
| 443 mdns_runner_->DeleteSoon(FROM_HERE, client_.release()); | 443 mdns_runner_->DeleteSoon(FROM_HERE, client_.release()); |
| 444 if (mdns_) | 444 if (mdns_) |
| 445 mdns_runner_->DeleteSoon(FROM_HERE, mdns_.release()); | 445 mdns_runner_->DeleteSoon(FROM_HERE, mdns_.release()); |
| 446 } | 446 } |
| 447 | 447 |
| 448 } // namespace local_discovery | 448 } // namespace local_discovery |
| OLD | NEW |