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 3// found in the LICENSE file. 4 5#include "chromecast/service/cast_service.h" 6 7#include "base/logging.h" 8#include "base/threading/thread_checker.h" 9 10namespace chromecast { 11 12CastService::CastService(content::BrowserContext* browser_context) 13 : browser_context_(browser_context), 14 stopped_(true), 15 thread_checker_(new base::ThreadChecker()) { 16} 17 18CastService::~CastService() { 19 DCHECK(thread_checker_->CalledOnValidThread()); 20 DCHECK(stopped_); 21} 22 23void CastService::Start() { 24 DCHECK(thread_checker_->CalledOnValidThread()); 25 26 Initialize(); 27 stopped_ = false; 28 StartInternal(); 29} 30 31void CastService::Stop() { 32 DCHECK(thread_checker_->CalledOnValidThread()); 33 StopInternal(); 34 stopped_ = true; 35} 36 37} // namespace chromecast 38