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

Side by Side Diff: chrome/renderer/extensions/cast_streaming_native_handler.h

Issue 184853003: Cast: Add GetStats() extensions API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: static cast to int 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
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 #ifndef CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_ 5 #ifndef CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_
6 #define CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_ 6 #define CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/renderer/extensions/object_backed_native_handler.h" 12 #include "chrome/renderer/extensions/object_backed_native_handler.h"
13 #include "chrome/renderer/extensions/scoped_persistent.h" 13 #include "chrome/renderer/extensions/scoped_persistent.h"
14 #include "v8/include/v8.h" 14 #include "v8/include/v8.h"
15 15
16 class CastRtpStream; 16 class CastRtpStream;
17 class CastUdpTransport; 17 class CastUdpTransport;
18 18
19 namespace base {
20 class DictionaryValue;
21 }
22
19 namespace extensions { 23 namespace extensions {
20 24
21 class ChromeV8Context; 25 class ChromeV8Context;
22 26
23 // Native code that handle chrome.webrtc custom bindings. 27 // Native code that handle chrome.webrtc custom bindings.
24 class CastStreamingNativeHandler : public ObjectBackedNativeHandler { 28 class CastStreamingNativeHandler : public ObjectBackedNativeHandler {
25 public: 29 public:
26 explicit CastStreamingNativeHandler(ChromeV8Context* context); 30 explicit CastStreamingNativeHandler(ChromeV8Context* context);
27 virtual ~CastStreamingNativeHandler(); 31 virtual ~CastStreamingNativeHandler();
28 32
(...skipping 28 matching lines...) Expand all
57 void CallCreateCallback(scoped_ptr<CastRtpStream> stream1, 61 void CallCreateCallback(scoped_ptr<CastRtpStream> stream1,
58 scoped_ptr<CastRtpStream> stream2, 62 scoped_ptr<CastRtpStream> stream2,
59 scoped_ptr<CastUdpTransport> udp_transport); 63 scoped_ptr<CastUdpTransport> udp_transport);
60 64
61 void CallStartCallback(int stream_id); 65 void CallStartCallback(int stream_id);
62 void CallStopCallback(int stream_id); 66 void CallStopCallback(int stream_id);
63 void CallErrorCallback(int stream_id, const std::string& message); 67 void CallErrorCallback(int stream_id, const std::string& message);
64 68
65 void CallGetRawEventsCallback(int transport_id, 69 void CallGetRawEventsCallback(int transport_id,
66 scoped_ptr<std::string> raw_events); 70 scoped_ptr<std::string> raw_events);
71 void CallGetStatsCallback(int transport_id,
72 scoped_ptr<base::DictionaryValue> stats);
67 73
68 // Gets the RTP stream or UDP transport indexed by an ID. 74 // Gets the RTP stream or UDP transport indexed by an ID.
69 // If not found, returns NULL and throws a V8 exception. 75 // If not found, returns NULL and throws a V8 exception.
70 CastRtpStream* GetRtpStreamOrThrow(int stream_id) const; 76 CastRtpStream* GetRtpStreamOrThrow(int stream_id) const;
71 CastUdpTransport* GetUdpTransportOrThrow(int transport_id) const; 77 CastUdpTransport* GetUdpTransportOrThrow(int transport_id) const;
72 78
73 int last_transport_id_; 79 int last_transport_id_;
74 80
75 typedef std::map<int, linked_ptr<CastRtpStream> > RtpStreamMap; 81 typedef std::map<int, linked_ptr<CastRtpStream> > RtpStreamMap;
76 RtpStreamMap rtp_stream_map_; 82 RtpStreamMap rtp_stream_map_;
77 83
78 typedef std::map<int, linked_ptr<CastUdpTransport> > UdpTransportMap; 84 typedef std::map<int, linked_ptr<CastUdpTransport> > UdpTransportMap;
79 UdpTransportMap udp_transport_map_; 85 UdpTransportMap udp_transport_map_;
80 86
81 base::WeakPtrFactory<CastStreamingNativeHandler> weak_factory_; 87 base::WeakPtrFactory<CastStreamingNativeHandler> weak_factory_;
82 88
83 extensions::ScopedPersistent<v8::Function> create_callback_; 89 extensions::ScopedPersistent<v8::Function> create_callback_;
84 90
85 typedef std::map<int, 91 typedef std::map<int,
86 linked_ptr<extensions::ScopedPersistent<v8::Function> > > 92 linked_ptr<extensions::ScopedPersistent<v8::Function> > >
87 RtpStreamCallbackMap; 93 RtpStreamCallbackMap;
88 RtpStreamCallbackMap get_raw_events_callbacks_; 94 RtpStreamCallbackMap get_raw_events_callbacks_;
95 RtpStreamCallbackMap get_stats_callbacks_;
89 96
90 DISALLOW_COPY_AND_ASSIGN(CastStreamingNativeHandler); 97 DISALLOW_COPY_AND_ASSIGN(CastStreamingNativeHandler);
91 }; 98 };
92 99
93 } // namespace extensions 100 } // namespace extensions
94 101
95 #endif // CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_ 102 #endif // CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698