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

Side by Side Diff: chrome/renderer/media/cast_session.cc

Issue 170063006: Cast: Add JS API to get raw events logs from cast extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed alpha's comments 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/media/cast_session.h" 5 #include "chrome/renderer/media/cast_session.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "chrome/renderer/media/cast_session_delegate.h" 8 #include "chrome/renderer/media/cast_session_delegate.h"
9 #include "content/public/renderer/render_thread.h" 9 #include "content/public/renderer/render_thread.h"
10 #include "media/base/bind_to_current_loop.h" 10 #include "media/base/bind_to_current_loop.h"
11 #include "media/base/video_frame.h" 11 #include "media/base/video_frame.h"
12 #include "media/cast/cast_config.h" 12 #include "media/cast/cast_config.h"
13 #include "media/cast/cast_sender.h" 13 #include "media/cast/cast_sender.h"
14 #include "media/cast/logging/logging_defines.h"
14 15
15 CastSession::CastSession() 16 CastSession::CastSession()
16 : delegate_(new CastSessionDelegate()), 17 : delegate_(new CastSessionDelegate()),
17 io_message_loop_proxy_( 18 io_message_loop_proxy_(
18 content::RenderThread::Get()->GetIOMessageLoopProxy()) {} 19 content::RenderThread::Get()->GetIOMessageLoopProxy()) {}
19 20
20 CastSession::~CastSession() { 21 CastSession::~CastSession() {
21 // We should always be able to delete the object on the IO thread. 22 // We should always be able to delete the object on the IO thread.
22 CHECK(io_message_loop_proxy_->DeleteSoon(FROM_HERE, delegate_.release())); 23 CHECK(io_message_loop_proxy_->DeleteSoon(FROM_HERE, delegate_.release()));
23 } 24 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 const net::IPEndPoint& remote_endpoint) { 57 const net::IPEndPoint& remote_endpoint) {
57 io_message_loop_proxy_->PostTask( 58 io_message_loop_proxy_->PostTask(
58 FROM_HERE, 59 FROM_HERE,
59 base::Bind( 60 base::Bind(
60 &CastSessionDelegate::StartUDP, 61 &CastSessionDelegate::StartUDP,
61 base::Unretained(delegate_.get()), 62 base::Unretained(delegate_.get()),
62 local_endpoint, 63 local_endpoint,
63 remote_endpoint)); 64 remote_endpoint));
64 } 65 }
65 66
66 void CastSession::GetEventLogsAndReset(const EventLogsCallback& callback) { 67 void CastSession::ToggleLogging(const int stream_id,
68 const bool enable,
69 const bool is_audio) {
70 io_message_loop_proxy_->PostTask(
71 FROM_HERE,
72 base::Bind(&CastSessionDelegate::ToggleLogging,
73 base::Unretained(delegate_.get()),
74 stream_id,
75 enable,
76 is_audio));
77 }
78
79 void CastSession::GetEventLogsAndReset(const EventLogsCallback& callback,
80 const int stream_id) {
67 io_message_loop_proxy_->PostTask( 81 io_message_loop_proxy_->PostTask(
68 FROM_HERE, 82 FROM_HERE,
69 base::Bind(&CastSessionDelegate::GetEventLogsAndReset, 83 base::Bind(&CastSessionDelegate::GetEventLogsAndReset,
70 base::Unretained(delegate_.get()), 84 base::Unretained(delegate_.get()),
71 callback)); 85 media::BindToCurrentLoop(callback),
86 stream_id));
72 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698