Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: chrome/renderer/media/cast_threads.h

Issue 174403002: Cast: Don't create threads for each CastSessionDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing files Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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 // Manages threads used by Cast Streaming Extensions API. There is a
6 // singleton object of this class in the renderer.
7 //
8 // There are two threads owned by this class:
9 // 1. Audio encode thread.
10 // 2. Video encode thread.
11 // These two threads are started when the first CastSessionDelegate is
12 // created. When the last CastSessionDelegate is destroyed these threads
13 // are stopped.
14
15 #ifndef CHROME_RENDERER_MEDIA_CAST_THREADS_H_
16 #define CHROME_RENDERER_MEDIA_CAST_THREADS_H_
17
18 #include "base/threading/thread.h"
19
20 class CastThreads {
21 public:
22 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.
23 ~CastThreads();
24
25 // IncrementUsage() is called when a CastSessionDelegate is created in
26 // the renderer. When CastSessionDelegate is being destroyed it calls
27 // DecrementUsage().
28 // The first call to IncrementUsage() will start both audio and video
29 // encode threads. The last call to DecrementUsage() will stop these
30 // two threads.
31 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
32 void DecrementUsage();
33
34 scoped_refptr<base::MessageLoopProxy> GetAudioEncodeMessageLoopProxy();
35 scoped_refptr<base::MessageLoopProxy> GetVideoEncodeMessageLoopProxy();
36
37 private:
38 int use_count_;
39 base::Thread audio_encode_thread_;
40 base::Thread video_encode_thread_;
41 };
scherkus (not reviewing) 2014/02/21 22:01:03 DISALLOW etc...
Alpha Left Google 2014/02/22 01:04:34 Done.
42
43 #endif // CHROME_RENDERER_MEDIA_CAST_THREADS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698