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 "chromecast/browser/service/cast_service.h" | 5 #include "chromecast/browser/service/cast_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
10 | 10 |
11 namespace chromecast { | 11 namespace chromecast { |
12 | 12 |
13 CastService::CastService( | 13 CastService::CastService( |
14 content::BrowserContext* browser_context, | 14 content::BrowserContext* browser_context, |
15 PrefService* pref_service, | 15 PrefService* pref_service) |
16 metrics::CastMetricsServiceClient* metrics_service_client) | |
17 : browser_context_(browser_context), | 16 : browser_context_(browser_context), |
18 pref_service_(pref_service), | 17 pref_service_(pref_service), |
19 metrics_service_client_(metrics_service_client), | |
20 stopped_(true), | 18 stopped_(true), |
21 thread_checker_(new base::ThreadChecker()) { | 19 thread_checker_(new base::ThreadChecker()) { |
22 } | 20 } |
23 | 21 |
24 CastService::~CastService() { | 22 CastService::~CastService() { |
25 DCHECK(thread_checker_->CalledOnValidThread()); | 23 DCHECK(thread_checker_->CalledOnValidThread()); |
26 DCHECK(stopped_); | 24 DCHECK(stopped_); |
27 } | 25 } |
28 | 26 |
29 void CastService::Initialize() { | 27 void CastService::Initialize() { |
(...skipping 15 matching lines...) Expand all Loading... |
45 void CastService::Stop() { | 43 void CastService::Stop() { |
46 DCHECK(thread_checker_->CalledOnValidThread()); | 44 DCHECK(thread_checker_->CalledOnValidThread()); |
47 StopInternal(); | 45 StopInternal(); |
48 // Consume any pending tasks which should be done before destroying in-process | 46 // Consume any pending tasks which should be done before destroying in-process |
49 // renderer process, for example, destroying web_contents. | 47 // renderer process, for example, destroying web_contents. |
50 base::RunLoop().RunUntilIdle(); | 48 base::RunLoop().RunUntilIdle(); |
51 stopped_ = true; | 49 stopped_ = true; |
52 } | 50 } |
53 | 51 |
54 } // namespace chromecast | 52 } // namespace chromecast |
OLD | NEW |