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

Unified Diff: content/renderer/media/audio_message_filter.h

Issue 7157001: Implements AudioMessageFilter as member in RenderThread (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/audio_message_filter.h
===================================================================
--- content/renderer/media/audio_message_filter.h (revision 89645)
+++ content/renderer/media/audio_message_filter.h (working copy)
@@ -13,6 +13,7 @@
#include "base/gtest_prod_util.h"
#include "base/id_map.h"
+#include "base/memory/singleton.h"
#include "base/shared_memory.h"
#include "base/sync_socket.h"
#include "content/common/media/audio_stream_state.h"
@@ -52,9 +53,20 @@
virtual ~Delegate() {}
};
- explicit AudioMessageFilter(int32 route_id);
- virtual ~AudioMessageFilter();
+ enum RoutingIDs {
+ // Indicates that we don't have a routing ID yet.
+ ROUTING_ID_HAS_NOT_BEEN_SET = -1,
scherkus (not reviewing) 2011/06/21 17:24:00 this doesn't need to be in .h file also kCamelCas
jam 2011/06/21 19:02:04 we already have a value for this: MSG_ROUTING_NONE
+ };
+ // Classes using the Singleton<T> pattern should declare a GetInstance()
+ // method and call Singleton::get() from within that.
+ static AudioMessageFilter* GetInstance();
+
+ // Sets the routing ID for all transmitted messages.
+ void SetRoutingID(int32 id);
scherkus (not reviewing) 2011/06/21 17:24:00 I'm not too hot on having every callee remember to
+
+ bool RoutingIDHasBeenSet() const;
+
// Add a delegate to the map and return id of the entry.
int32 AddDelegate(Delegate* delegate);
@@ -66,10 +78,16 @@
MessageLoop* message_loop() { return message_loop_; }
+ int32 routing_id() { return routing_id_; }
scherkus (not reviewing) 2011/06/21 17:24:00 I don't think I saw anyone actually call this meth
+
private:
- // For access to |message_loop_|.
- friend class AudioRendererImplTest;
+ // This allows constructor and destructor to be private and usable only
+ // by the Singleton class.
+ friend struct RefCountedSingletonTraits<AudioMessageFilter>;
+ AudioMessageFilter();
+ virtual ~AudioMessageFilter();
+
FRIEND_TEST_ALL_PREFIXES(AudioMessageFilterTest, Basic);
FRIEND_TEST_ALL_PREFIXES(AudioMessageFilterTest, Delegates);
@@ -110,7 +128,7 @@
IPC::Channel* channel_;
- int32 route_id_;
+ int32 routing_id_;
MessageLoop* message_loop_;

Powered by Google App Engine
This is Rietveld 408576698