LCOV - code coverage report
Current view: directory - objdir/dist/include/mozilla/dom - DOMRequest.h (source / functions) Found Hit Coverage
Test: app.info Lines: 5 0 0.0 %
Date: 2012-06-02 Functions: 2 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* vim: set ts=2 et sw=2 tw=80: */
       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 file,
       5                 :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6                 : 
       7                 : #ifndef mozilla_dom_domrequest_h__
       8                 : #define mozilla_dom_domrequest_h__
       9                 : 
      10                 : #include "nsIDOMDOMRequest.h"
      11                 : #include "nsIDOMDOMError.h"
      12                 : #include "nsDOMEventTargetHelper.h"
      13                 : #include "nsContentUtils.h"
      14                 : 
      15                 : #include "nsCOMPtr.h"
      16                 : 
      17                 : namespace mozilla {
      18                 : namespace dom {
      19                 : 
      20                 : class DOMRequest : public nsDOMEventTargetHelper,
      21                 :                    public nsIDOMDOMRequest
      22                 : {
      23                 :   bool mDone;
      24                 :   jsval mResult;
      25                 :   nsCOMPtr<nsIDOMDOMError> mError;
      26                 :   bool mRooted;
      27                 : 
      28                 :   NS_DECL_EVENT_HANDLER(success)
      29                 :   NS_DECL_EVENT_HANDLER(error)
      30                 : 
      31                 : public:
      32                 :   NS_DECL_ISUPPORTS_INHERITED
      33                 :   NS_DECL_NSIDOMDOMREQUEST
      34                 :   NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
      35                 : 
      36                 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(DOMRequest,
      37                 :                                                          nsDOMEventTargetHelper)
      38                 : 
      39                 :   void FireSuccess(jsval aResult);
      40                 :   void FireError(const nsAString& aError);
      41                 : 
      42                 :   DOMRequest(nsIDOMWindow* aWindow);
      43                 : 
      44                 :   virtual ~DOMRequest()
      45                 :   {
      46                 :     UnrootResultVal();
      47                 :   }
      48                 : 
      49                 : private:
      50                 :   void FireEvent(const nsAString& aType);
      51                 : 
      52                 :   void RootResultVal()
      53                 :   {
      54                 :     if (!mRooted) {
      55                 :       NS_HOLD_JS_OBJECTS(this, DOMRequest);
      56                 :       mRooted = true;
      57                 :     }
      58                 :   }
      59                 : 
      60                 :   void UnrootResultVal()
      61                 :   {
      62                 :     if (mRooted) {
      63                 :       NS_DROP_JS_OBJECTS(this, DOMRequest);
      64                 :       mRooted = false;
      65                 :     }
      66                 :   }
      67                 : };
      68                 : 
      69                 : class DOMRequestService : public nsIDOMRequestService
      70               0 : {
      71                 : public:
      72                 :   NS_DECL_ISUPPORTS
      73                 :   NS_DECL_NSIDOMREQUESTSERVICE
      74                 : 
      75                 :   // Returns an owning reference! No one should call this but the factory.
      76               0 :   static DOMRequestService* FactoryCreate()
      77                 :   {
      78               0 :     DOMRequestService* res = new DOMRequestService;
      79               0 :     NS_ADDREF(res);
      80               0 :     return res;
      81                 :   }
      82                 : };
      83                 : 
      84                 : } // namespace dom
      85                 : } // namespace mozilla
      86                 : 
      87                 : #define DOMREQUEST_SERVICE_CONTRACTID "@mozilla.org/dom/dom-request-service;1"
      88                 : 
      89                 : #endif // mozilla_dom_domrequest_h__

Generated by: LCOV version 1.7