From 038974b5525b09973e836309d4e731c19dc12972 Mon Sep 17 00:00:00 2001 From: "hclam@chromium.org" Date: Tue, 3 Dec 2013 15:45:44 +0000 Subject: Cast Extensions API: Major namespace and object renaming There is no functional change in this patch. This change only does renaming. Extensions API namespaces: webrtc.castSendTransport -> cast.streaming.rtpStream webrtc.castUdpTransport -> cast.streaming.udpTransport Class renaming: WebRtcNativeHandler -> CastStreamingNativeHandler CastSendTransport -> CastRtpStream Tests and related files are also renamed to get rid of the webrtc label. BUG=301920 Review URL: https://codereview.chromium.org/90083002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238403 0039d316-1c4b-4281-b951-d872f2087c98 --- .../extensions/cast_streaming_native_handler.h | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 chrome/renderer/extensions/cast_streaming_native_handler.h (limited to 'chrome/renderer/extensions/cast_streaming_native_handler.h') diff --git a/chrome/renderer/extensions/cast_streaming_native_handler.h b/chrome/renderer/extensions/cast_streaming_native_handler.h new file mode 100644 index 0000000..4c2360c --- /dev/null +++ b/chrome/renderer/extensions/cast_streaming_native_handler.h @@ -0,0 +1,79 @@ +// Copyright 2013 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 CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_ +#define CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_ + +#include + +#include "base/memory/linked_ptr.h" +#include "base/memory/weak_ptr.h" +#include "chrome/renderer/extensions/object_backed_native_handler.h" +#include "chrome/renderer/extensions/scoped_persistent.h" +#include "v8/include/v8.h" + +class CastRtpStream; +class CastUdpTransport; + +namespace extensions { + +class ChromeV8Context; + +// Native code that handle chrome.webrtc custom bindings. +class CastStreamingNativeHandler : public ObjectBackedNativeHandler { + public: + explicit CastStreamingNativeHandler(ChromeV8Context* context); + virtual ~CastStreamingNativeHandler(); + + private: + void CreateCastSession( + const v8::FunctionCallbackInfo& args); + + void DestroyCastRtpStream( + const v8::FunctionCallbackInfo& args); + void CreateParamsCastRtpStream( + const v8::FunctionCallbackInfo& args); + void GetCapsCastRtpStream( + const v8::FunctionCallbackInfo& args); + void StartCastRtpStream( + const v8::FunctionCallbackInfo& args); + void StopCastRtpStream( + const v8::FunctionCallbackInfo& args); + + void DestroyCastUdpTransport( + const v8::FunctionCallbackInfo& args); + void StartCastUdpTransport( + const v8::FunctionCallbackInfo& args); + void StopCastUdpTransport( + const v8::FunctionCallbackInfo& args); + + // Helper method to call the v8 callback function after a session is + // created. + void CallCreateCallback(scoped_ptr stream1, + scoped_ptr stream2, + scoped_ptr udp_transport); + + // Gets the RTP stream or UDP transport indexed by an ID. + // If not found, returns NULL and throws a V8 exception. + CastRtpStream* GetRtpStreamOrThrow(int stream_id) const; + CastUdpTransport* GetUdpTransportOrThrow(int transport_id) const; + + int last_transport_id_; + + typedef std::map > RtpStreamMap; + RtpStreamMap rtp_stream_map_; + + typedef std::map > UdpTransportMap; + UdpTransportMap udp_transport_map_; + + base::WeakPtrFactory weak_factory_; + + extensions::ScopedPersistent create_callback_; + + DISALLOW_COPY_AND_ASSIGN(CastStreamingNativeHandler); +}; + +} // namespace extensions + +#endif // CHROME_RENDERER_EXTENSIONS_CAST_STREAMING_NATIVE_HANDLER_H_ -- cgit v1.1