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

Side by Side Diff: content/browser/renderer_host/media/media_stream_track_metrics_host.h

Issue 183973021: Add metrics to track the duration of tracks received over a PeerConnection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 6 years, 9 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H_
perkj_chrome 2014/03/12 07:12:40 nit : git mv is the reviewers friend I think.Or lo
Jói 2014/03/12 08:50:04 I used git mv, indirectly. There are two problems:
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/time/time.h"
12 #include "content/public/browser/browser_message_filter.h"
13 #include "content/public/browser/render_process_host_observer.h"
14
15 namespace content {
16
17 // Responsible for logging metrics about audio and video track
18 // lifetimes. These are based on messages from the renderer that are
19 // sent when tracks are created and destroyed. Unfortunately we can't
20 // reliably log the lifetime metric in the renderer because that
21 // process may be destroyed at any time by the fast shutdown path (see
22 // RenderProcessHost::FastShutdownIfPossible).
23 //
24 // There is one instance of this class per render process.
25 //
26 // If the renderer process goes away without sending messages that
27 // tracks were removed, this class instead infers that the tracks were
28 // removed.
29 class MediaStreamTrackMetricsHost
30 : public BrowserMessageFilter,
31 public RenderProcessHostObserver {
32 public:
33 explicit MediaStreamTrackMetricsHost(RenderProcessHost* owner);
34
35 protected:
36 virtual ~MediaStreamTrackMetricsHost();
37
38 // BrowserMessageFilter override.
39 virtual bool OnMessageReceived(const IPC::Message& message,
40 bool* message_was_ok) OVERRIDE;
41
42 // RenderProcessHostObserver override.
43 virtual void RenderProcessExited(RenderProcessHost* host,
44 base::ProcessHandle handle,
45 base::TerminationStatus status,
46 int exit_code) OVERRIDE;
47
48 private:
49 void OnAddTrack(const std::string& id, bool is_audio, bool is_remote);
50 void OnRemoveTrack(const std::string& id);
51
52 void ReportDuration(bool is_audio, base::TimeTicks start_time);
53
54 // Keys are track IDs, values are pairs: A boolean indicating
55 // whether the track is an audio track, and a timestamp from when
56 // the track was created.
57 typedef std::pair<bool, base::TimeTicks> IsAudioPlusTimestamp;
58 typedef std::map<std::string, IsAudioPlusTimestamp> TrackMap;
59 TrackMap tracks_;
60
61 // Non-owning pointer.
62 RenderProcessHost* owner_;
63 };
64
65 } // namespace content
66
67 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_H _
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_track_metrics_host.cc » ('j') | content/content_browser.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698