Chromium Code Reviews| Index: chrome/renderer/media/cast_threads.h |
| diff --git a/chrome/renderer/media/cast_threads.h b/chrome/renderer/media/cast_threads.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1dd71a95610b975263a3355eea5cefa07b57ed6d |
| --- /dev/null |
| +++ b/chrome/renderer/media/cast_threads.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Manages threads used by Cast Streaming Extensions API. There is a |
| +// singleton object of this class in the renderer. |
| +// |
| +// There are two threads owned by this class: |
| +// 1. Audio encode thread. |
| +// 2. Video encode thread. |
| +// These two threads are started when the first CastSessionDelegate is |
| +// created. When the last CastSessionDelegate is destroyed these threads |
| +// are stopped. |
| + |
| +#ifndef CHROME_RENDERER_MEDIA_CAST_THREADS_H_ |
| +#define CHROME_RENDERER_MEDIA_CAST_THREADS_H_ |
| + |
| +#include "base/threading/thread.h" |
| + |
| +class CastThreads { |
| + public: |
| + CastThreads(); |
|
scherkus (not reviewing)
2014/02/21 22:01:03
these can be made private and have something like:
Alpha Left Google
2014/02/22 01:04:34
Done.
|
| + ~CastThreads(); |
| + |
| + // IncrementUsage() is called when a CastSessionDelegate is created in |
| + // the renderer. When CastSessionDelegate is being destroyed it calls |
| + // DecrementUsage(). |
| + // The first call to IncrementUsage() will start both audio and video |
| + // encode threads. The last call to DecrementUsage() will stop these |
| + // two threads. |
| + void IncrementUsage(); |
|
scherkus (not reviewing)
2014/02/21 22:01:03
it might be overkill ... but you could declare a h
Alpha Left Google
2014/02/22 01:04:34
Okay I just create threads then this CastThreads i
|
| + void DecrementUsage(); |
| + |
| + scoped_refptr<base::MessageLoopProxy> GetAudioEncodeMessageLoopProxy(); |
| + scoped_refptr<base::MessageLoopProxy> GetVideoEncodeMessageLoopProxy(); |
| + |
| + private: |
| + int use_count_; |
| + base::Thread audio_encode_thread_; |
| + base::Thread video_encode_thread_; |
| +}; |
|
scherkus (not reviewing)
2014/02/21 22:01:03
DISALLOW etc...
Alpha Left Google
2014/02/22 01:04:34
Done.
|
| + |
| +#endif // CHROME_RENDERER_MEDIA_CAST_THREADS_H_ |