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

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

Issue 334743006: Support multiple files for AEC dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again... Created 6 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
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/aec_dump_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/aec_dump_message_filter.h
diff --git a/content/renderer/media/aec_dump_message_filter.h b/content/renderer/media/aec_dump_message_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..7268132d2ef7c89937eed51c3211b014e8da22bc
--- /dev/null
+++ b/content/renderer/media/aec_dump_message_filter.h
@@ -0,0 +1,108 @@
+// 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.
+
+#ifndef CONTENT_RENDERER_MEDIA_AEC_DUMP_MESSAGE_FILTER_H_
+#define CONTENT_RENDERER_MEDIA_AEC_DUMP_MESSAGE_FILTER_H_
+
+#include "base/gtest_prod_util.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
+#include "content/renderer/render_thread_impl.h"
+#include "ipc/ipc_platform_file.h"
+#include "ipc/message_filter.h"
+
+namespace base {
+class MessageLoopProxy;
+}
+
+namespace content {
+
+// MessageFilter that handles AEC dump messages and forwards them to an
+// observer.
+class CONTENT_EXPORT AecDumpMessageFilter : public IPC::MessageFilter {
+ public:
+ class AecDumpDelegate {
+ public:
+ virtual void OnAecDumpFile(
+ const IPC::PlatformFileForTransit& file_handle) = 0;
+ virtual void OnDisableAecDump() = 0;
+ virtual void OnIpcClosing() = 0;
+ };
+
+ AecDumpMessageFilter(
+ const scoped_refptr<base::MessageLoopProxy>& io_message_loop,
+ const scoped_refptr<base::MessageLoopProxy>& main_message_loop);
+
+ // Getter for the one AecDumpMessageFilter object.
+ static scoped_refptr<AecDumpMessageFilter> Get();
+
+ // Adds a delegate that receives the enable and disable notifications.
+ void AddDelegate(AecDumpMessageFilter::AecDumpDelegate* delegate);
+
+ // Removes a delegate.
+ void RemoveDelegate(AecDumpMessageFilter::AecDumpDelegate* delegate);
+
+ // IO message loop associated with this message filter.
+ scoped_refptr<base::MessageLoopProxy> io_message_loop() const {
+ return io_message_loop_;
+ }
+
+ protected:
+ virtual ~AecDumpMessageFilter();
+
+ private:
+ // Sends an IPC message using |sender_|.
+ void Send(IPC::Message* message);
+
+ // Registers a consumer of AEC dump in the browser process. This consumer will
+ // get a file handle when the AEC dump is enabled and a notification when it
+ // is disabled.
+ void RegisterAecDumpConsumer(int id);
+
+ // Unregisters a consumer of AEC dump in the browser process.
+ void UnregisterAecDumpConsumer(int id);
+
+ // IPC::MessageFilter override. Called on |io_message_loop|.
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE;
+ virtual void OnFilterRemoved() OVERRIDE;
+ virtual void OnChannelClosing() OVERRIDE;
+
+ // Accessed on |io_message_loop|.
+ void OnEnableAecDump(int id, IPC::PlatformFileForTransit file_handle);
+ void OnDisableAecDump();
+
+ // Accessed on |main_message_loop_|.
+ void DoEnableAecDump(int id, IPC::PlatformFileForTransit file_handle);
+ void DoDisableAecDump();
+ void DoChannelClosingOnDelegates();
+ int GetIdForDelegate(AecDumpMessageFilter::AecDumpDelegate* delegate);
+
+ // Accessed on |io_message_loop_|.
+ IPC::Sender* sender_;
+
+ // The delgates for this filter. Must only be accessed on
+ // |main_message_loop_|.
+ typedef std::map<int, AecDumpMessageFilter::AecDumpDelegate*> DelegateMap;
+ DelegateMap delegates_;
+
+ // Counter for generating unique IDs to delegates. Accessed on
+ // |main_message_loop_|.
+ int delegate_id_counter_;
+
+ // Message loop on which IPC calls are driven.
+ const scoped_refptr<base::MessageLoopProxy> io_message_loop_;
+
+ // Main message loop.
+ const scoped_refptr<base::MessageLoopProxy> main_message_loop_;
+
+ // The singleton instance for this filter.
+ static AecDumpMessageFilter* g_filter;
+
+ DISALLOW_COPY_AND_ASSIGN(AecDumpMessageFilter);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_AEC_DUMP_MESSAGE_FILTER_H_
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/media/aec_dump_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698