Shaka Packager SDK
closure_thread.cc
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #include "packager/media/base/closure_thread.h"
8 
9 namespace shaka {
10 namespace media {
11 
13  const std::string& name_prefix,
14  const base::Closure& task)
15  : base::SimpleThread(name_prefix), task_(task) {}
16 
18  if (HasBeenStarted() && !HasBeenJoined())
19  Join();
20 }
21 
22 void ClosureThread::Run() { task_.Run(); }
23 
24 } // namespace media
25 } // namespace shaka
shaka
All the methods that are virtual are virtual for mocking.
Definition: gflags_hex_bytes.cc:11
shaka::media::ClosureThread::~ClosureThread
~ClosureThread() override
The destructor calls Join automatically if it is not yet joined.
Definition: closure_thread.cc:17
shaka::media::ClosureThread::ClosureThread
ClosureThread(const std::string &name_prefix, const base::Closure &task)
Definition: closure_thread.cc:12
shaka::media::ClosureThread::Run
void Run() override
SimpleThread implementation overrides.
Definition: closure_thread.cc:22