LCOV - code coverage report
Current view: top level - dom/webbrowserpersist - WebBrowserPersistResourcesParent.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 31 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  *
       3             :  * This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "WebBrowserPersistResourcesParent.h"
       8             : 
       9             : #include "nsThreadUtils.h"
      10             : 
      11             : namespace mozilla {
      12             : 
      13           0 : NS_IMPL_ISUPPORTS(WebBrowserPersistResourcesParent,
      14             :                   nsIWebBrowserPersistDocumentReceiver)
      15             : 
      16           0 : WebBrowserPersistResourcesParent::WebBrowserPersistResourcesParent(
      17             :         nsIWebBrowserPersistDocument* aDocument,
      18           0 :         nsIWebBrowserPersistResourceVisitor* aVisitor)
      19             : : mDocument(aDocument)
      20           0 : , mVisitor(aVisitor)
      21             : {
      22           0 :     MOZ_ASSERT(aDocument);
      23           0 :     MOZ_ASSERT(aVisitor);
      24           0 : }
      25             : 
      26             : WebBrowserPersistResourcesParent::~WebBrowserPersistResourcesParent() = default;
      27             : 
      28             : void
      29           0 : WebBrowserPersistResourcesParent::ActorDestroy(ActorDestroyReason aWhy)
      30             : {
      31           0 :     if (aWhy != Deletion && mVisitor) {
      32             :         // See comment in WebBrowserPersistDocumentParent::ActorDestroy
      33             :         // (or bug 1202887) for why this is deferred.
      34             :         nsCOMPtr<nsIRunnable> errorLater =
      35           0 :           NewRunnableMethod<nsCOMPtr<nsIWebBrowserPersistDocument>, nsresult>(
      36             :             "nsIWebBrowserPersistResourceVisitor::EndVisit",
      37             :             mVisitor,
      38             :             &nsIWebBrowserPersistResourceVisitor::EndVisit,
      39             :             mDocument,
      40           0 :             NS_ERROR_FAILURE);
      41           0 :         NS_DispatchToCurrentThread(errorLater);
      42             :     }
      43           0 :     mVisitor = nullptr;
      44           0 : }
      45             : 
      46             : mozilla::ipc::IPCResult
      47           0 : WebBrowserPersistResourcesParent::Recv__delete__(const nsresult& aStatus)
      48             : {
      49           0 :     mVisitor->EndVisit(mDocument, aStatus);
      50           0 :     mVisitor = nullptr;
      51           0 :     return IPC_OK();
      52             : }
      53             : 
      54             : mozilla::ipc::IPCResult
      55           0 : WebBrowserPersistResourcesParent::RecvVisitResource(const nsCString& aURI)
      56             : {
      57           0 :     mVisitor->VisitResource(mDocument, aURI);
      58           0 :     return IPC_OK();
      59             : }
      60             : 
      61             : mozilla::ipc::IPCResult
      62           0 : WebBrowserPersistResourcesParent::RecvVisitDocument(PWebBrowserPersistDocumentParent* aSubDocument)
      63             : {
      64             :     // Don't expose the subdocument to the visitor until it's ready
      65             :     // (until the actor isn't in START state).
      66             :     static_cast<WebBrowserPersistDocumentParent*>(aSubDocument)
      67           0 :         ->SetOnReady(this);
      68           0 :     return IPC_OK();
      69             : }
      70             : 
      71             : NS_IMETHODIMP
      72           0 : WebBrowserPersistResourcesParent::OnDocumentReady(nsIWebBrowserPersistDocument* aSubDocument)
      73             : {
      74           0 :     if (!mVisitor) {
      75           0 :         return NS_ERROR_FAILURE;
      76             :     }
      77           0 :     mVisitor->VisitDocument(mDocument, aSubDocument);
      78           0 :     return NS_OK;
      79             : }
      80             : 
      81             : NS_IMETHODIMP
      82           0 : WebBrowserPersistResourcesParent::OnError(nsresult aFailure)
      83             : {
      84             :     // Nothing useful to do but ignore the failed document.
      85           0 :     return NS_OK;
      86             : }
      87             : 
      88             : } // namespace mozilla

Generated by: LCOV version 1.13