Bug 1208417 - Part 1 - Add disconnect to nsIPresentationDevice & add a new nsIPresentationLocalDevice interface for 1-UA device, r=smaug
authorKuoE0 <kuoe0.tw@gmail.com>
Thu, 28 Apr 2016 15:05:16 +0800
changeset 295176 eaa9bd3a5d1b59b142dfaadab6ee3b43ffc11c7c
parent 295175 28f944410c7fdf27f7ddf16fc01be4eb0a6eade8
child 295177 4f95de9b438f19200f3399814348ea6dda563bc1
push id75837
push usergachen@mozilla.com
push dateThu, 28 Apr 2016 07:07:10 +0000
treeherdermozilla-inbound@c2da65057928 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1208417
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1208417 - Part 1 - Add disconnect to nsIPresentationDevice & add a new nsIPresentationLocalDevice interface for 1-UA device, r=smaug
dom/presentation/PresentationSessionInfo.cpp
dom/presentation/interfaces/moz.build
dom/presentation/interfaces/nsIPresentationDevice.idl
dom/presentation/interfaces/nsIPresentationLocalDevice.idl
dom/presentation/provider/MulticastDNSDeviceProvider.cpp
--- a/dom/presentation/PresentationSessionInfo.cpp
+++ b/dom/presentation/PresentationSessionInfo.cpp
@@ -784,16 +784,20 @@ void
 PresentationPresentingInfo::Shutdown(nsresult aReason)
 {
   PresentationSessionInfo::Shutdown(aReason);
 
   if (mTimer) {
     mTimer->Cancel();
   }
 
+  if (mDevice) {
+    mDevice->Disconnect();
+  }
+  mDevice = nullptr;
   mLoadingCallback = nullptr;
   mRequesterDescription = nullptr;
   mPromise = nullptr;
 }
 
 // nsIPresentationSessionTransportBuilderListener
 NS_IMETHODIMP
 PresentationPresentingInfo::OnSessionTransport(nsIPresentationSessionTransport* transport)
--- a/dom/presentation/interfaces/moz.build
+++ b/dom/presentation/interfaces/moz.build
@@ -6,16 +6,17 @@
 
 XPIDL_SOURCES += [
     'nsIPresentationControlChannel.idl',
     'nsIPresentationDevice.idl',
     'nsIPresentationDeviceManager.idl',
     'nsIPresentationDevicePrompt.idl',
     'nsIPresentationDeviceProvider.idl',
     'nsIPresentationListener.idl',
+    'nsIPresentationLocalDevice.idl',
     'nsIPresentationRequestUIGlue.idl',
     'nsIPresentationService.idl',
     'nsIPresentationSessionRequest.idl',
     'nsIPresentationSessionTransport.idl',
     'nsIPresentationSessionTransportBuilder.idl',
     'nsITCPPresentationServer.idl',
 ]
 
--- a/dom/presentation/interfaces/nsIPresentationDevice.idl
+++ b/dom/presentation/interfaces/nsIPresentationDevice.idl
@@ -13,22 +13,25 @@ interface nsIPresentationControlChannel;
 interface nsIPresentationDevice : nsISupports
 {
   // The unique Id for the device. UUID is recommanded.
   readonly attribute AUTF8String id;
 
   // The human-readable name of this device.
   readonly attribute AUTF8String name;
 
-  //TODO expose more info in order to fulfill UX spec
+  // TODO expose more info in order to fulfill UX spec
   // The category of this device, could be "wifi", "bluetooth", "hdmi", etc.
   readonly attribute AUTF8String type;
 
   /*
    * Establish a control channel to this device.
    * @param url The URL requested to open by remote device.
    * @param presentationId The Id for representing this session.
    * @returns The control channel for this session.
    * @throws  NS_ERROR_FAILURE if the establishment fails
    */
   nsIPresentationControlChannel establishControlChannel(in DOMString url,
                                                         in DOMString presentationId);
+
+  // Do something when presentation session is disconnected.
+  void disconnect();
 };
new file mode 100644
--- /dev/null
+++ b/dom/presentation/interfaces/nsIPresentationLocalDevice.idl
@@ -0,0 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIPresentationDevice.idl"
+
+/*
+ * Local device.
+ * This device is used for 1-UA use case. The result for display is rendered by
+ * this host device.
+ */
+[scriptable, uuid(dd239720-cab6-4fb5-9025-cba23f1bbc2d)]
+interface nsIPresentationLocalDevice : nsIPresentationDevice
+{
+  // (1-UA only) The property is used to get the window ID of 1-UA device.
+  readonly attribute AUTF8String windowId;
+};
--- a/dom/presentation/provider/MulticastDNSDeviceProvider.cpp
+++ b/dom/presentation/provider/MulticastDNSDeviceProvider.cpp
@@ -1047,11 +1047,17 @@ MulticastDNSDeviceProvider::Device::Esta
 {
   if (!mProvider) {
     return NS_ERROR_FAILURE;
   }
 
   return mProvider->RequestSession(this, aUrl, aPresentationId, aRetVal);
 }
 
+NS_IMETHODIMP
+MulticastDNSDeviceProvider::Device::Disconnect()
+{
+  return NS_OK;
+}
+
 } // namespace presentation
 } // namespace dom
 } // namespace mozilla