Bug 1269162 - part 2 - Move XHRUpload in workers to XMLHttpRequestUploadWorker, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 27 Jun 2016 19:13:40 +0200
changeset 381532 c01653e7ad7c25b718e9245e6495ef8c1d8822dc
parent 381531 1e12af97993d0c98ce029bf35b23b19bac0434ca
child 381533 55a63a62c0dd798ba7ea9c5ab08d49a48588a0d4
push id21504
push userbmo:npang@mozilla.com
push dateMon, 27 Jun 2016 18:10:09 +0000
reviewerssmaug
bugs1269162
milestone50.0a1
Bug 1269162 - part 2 - Move XHRUpload in workers to XMLHttpRequestUploadWorker, r=smaug
dom/bindings/Bindings.conf
dom/workers/XMLHttpRequestUpload.cpp
dom/workers/XMLHttpRequestUpload.h
dom/workers/XMLHttpRequestUploadWorker.cpp
dom/workers/XMLHttpRequestUploadWorker.h
dom/workers/XMLHttpRequestWorker.cpp
dom/workers/XMLHttpRequestWorker.h
dom/workers/moz.build
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1595,16 +1595,18 @@ DOMInterfaces = {
 },
 
 'XMLHttpRequestUpload': [
 {
     'nativeType': 'nsXMLHttpRequestUpload',
     'headerFile': 'nsXMLHttpRequest.h'
 },
 {
+    'nativeType': 'mozilla::dom::workers::XMLHttpRequestUploadWorker',
+    'headerFile': 'mozilla/dom/workers/bindings/XMLHttpRequestUploadWorker.h',
     'workers': True,
 }],
 
 'XMLSerializer': {
     'nativeType': 'nsDOMSerializer',
 },
 
 'XPathEvaluator': {
rename from dom/workers/XMLHttpRequestUpload.cpp
rename to dom/workers/XMLHttpRequestUploadWorker.cpp
--- a/dom/workers/XMLHttpRequestUpload.cpp
+++ b/dom/workers/XMLHttpRequestUploadWorker.cpp
@@ -1,45 +1,45 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "XMLHttpRequestUpload.h"
+#include "XMLHttpRequestUploadWorker.h"
 
 #include "XMLHttpRequestWorker.h"
 
 #include "mozilla/dom/XMLHttpRequestUploadBinding.h"
 
 USING_WORKERS_NAMESPACE
 
-XMLHttpRequestUpload::XMLHttpRequestUpload(XMLHttpRequestWorker* aXHR)
+XMLHttpRequestUploadWorker::XMLHttpRequestUploadWorker(XMLHttpRequestWorker* aXHR)
 : mXHR(aXHR)
 {
 }
 
-XMLHttpRequestUpload::~XMLHttpRequestUpload()
+XMLHttpRequestUploadWorker::~XMLHttpRequestUploadWorker()
 {
 }
 
-NS_IMPL_ADDREF_INHERITED(XMLHttpRequestUpload, nsXHREventTarget)
-NS_IMPL_RELEASE_INHERITED(XMLHttpRequestUpload, nsXHREventTarget)
+NS_IMPL_ADDREF_INHERITED(XMLHttpRequestUploadWorker, nsXHREventTarget)
+NS_IMPL_RELEASE_INHERITED(XMLHttpRequestUploadWorker, nsXHREventTarget)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XMLHttpRequestUpload)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XMLHttpRequestUploadWorker)
 NS_INTERFACE_MAP_END_INHERITING(nsXHREventTarget)
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED(XMLHttpRequestUpload, nsXHREventTarget,
+NS_IMPL_CYCLE_COLLECTION_INHERITED(XMLHttpRequestUploadWorker, nsXHREventTarget,
                                    mXHR)
 
 JSObject*
-XMLHttpRequestUpload::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+XMLHttpRequestUploadWorker::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return XMLHttpRequestUploadBinding_workers::Wrap(aCx, this, aGivenProto);
 }
 
 // static
-already_AddRefed<XMLHttpRequestUpload>
-XMLHttpRequestUpload::Create(XMLHttpRequestWorker* aXHR)
+already_AddRefed<XMLHttpRequestUploadWorker>
+XMLHttpRequestUploadWorker::Create(XMLHttpRequestWorker* aXHR)
 {
-  RefPtr<XMLHttpRequestUpload> upload = new XMLHttpRequestUpload(aXHR);
+  RefPtr<XMLHttpRequestUploadWorker> upload = new XMLHttpRequestUploadWorker(aXHR);
   return upload.forget();
 }
rename from dom/workers/XMLHttpRequestUpload.h
rename to dom/workers/XMLHttpRequestUploadWorker.h
--- a/dom/workers/XMLHttpRequestUpload.h
+++ b/dom/workers/XMLHttpRequestUploadWorker.h
@@ -8,32 +8,32 @@
 #define mozilla_dom_workers_xmlhttprequestupload_h__
 
 #include "nsXMLHttpRequest.h"
 
 BEGIN_WORKERS_NAMESPACE
 
 class XMLHttpRequestWorker;
 
-class XMLHttpRequestUpload final : public nsXHREventTarget
+class XMLHttpRequestUploadWorker final : public nsXHREventTarget
 {
   RefPtr<XMLHttpRequestWorker> mXHR;
 
-  explicit XMLHttpRequestUpload(XMLHttpRequestWorker* aXHR);
+  explicit XMLHttpRequestUploadWorker(XMLHttpRequestWorker* aXHR);
 
-  ~XMLHttpRequestUpload();
+  ~XMLHttpRequestUploadWorker();
 
 public:
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
-  static already_AddRefed<XMLHttpRequestUpload>
+  static already_AddRefed<XMLHttpRequestUploadWorker>
   Create(XMLHttpRequestWorker* aXHR);
 
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLHttpRequestUpload, nsXHREventTarget)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XMLHttpRequestUploadWorker, nsXHREventTarget)
 
   NS_DECL_ISUPPORTS_INHERITED
 
   nsISupports*
   GetParentObject() const
   {
     // There's only one global on a worker, so we don't need to specify.
     return nullptr;
--- a/dom/workers/XMLHttpRequestWorker.cpp
+++ b/dom/workers/XMLHttpRequestWorker.cpp
@@ -27,17 +27,17 @@
 #include "nsJSUtils.h"
 #include "nsThreadUtils.h"
 #include "nsVariant.h"
 
 #include "RuntimeService.h"
 #include "WorkerScope.h"
 #include "WorkerPrivate.h"
 #include "WorkerRunnable.h"
-#include "XMLHttpRequestUpload.h"
+#include "XMLHttpRequestUploadWorker.h"
 
 #include "mozilla/UniquePtr.h"
 
 using namespace mozilla;
 
 using namespace mozilla::dom;
 USING_WORKERS_NAMESPACE
 
@@ -2022,28 +2022,28 @@ XMLHttpRequestWorker::SetMozBackgroundRe
   }
 
   RefPtr<SetBackgroundRequestRunnable> runnable =
     new SetBackgroundRequestRunnable(mWorkerPrivate, mProxy,
                                      aBackgroundRequest);
   runnable->Dispatch(aRv);
 }
 
-XMLHttpRequestUpload*
+XMLHttpRequestUploadWorker*
 XMLHttpRequestWorker::GetUpload(ErrorResult& aRv)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
 
   if (mCanceled) {
     aRv.ThrowUncatchableException();
     return nullptr;
   }
 
   if (!mUpload) {
-    mUpload = XMLHttpRequestUpload::Create(this);
+    mUpload = XMLHttpRequestUploadWorker::Create(this);
 
     if (!mUpload) {
       aRv.Throw(NS_ERROR_FAILURE);
       return nullptr;
     }
   }
 
   return mUpload;
--- a/dom/workers/XMLHttpRequestWorker.h
+++ b/dom/workers/XMLHttpRequestWorker.h
@@ -21,17 +21,17 @@ namespace dom {
 class Blob;
 } // namespace dom
 } // namespace mozilla
 
 BEGIN_WORKERS_NAMESPACE
 
 class Proxy;
 class SendRunnable;
-class XMLHttpRequestUpload;
+class XMLHttpRequestUploadWorker;
 class WorkerPrivate;
 
 class XMLHttpRequestWorker final : public nsXHREventTarget,
                                    public WorkerHolder
 {
 public:
   struct StateData
   {
@@ -50,17 +50,17 @@ public:
       mResponseTextResult(NS_OK), mStatusResult(NS_OK),
       mResponseResult(NS_OK)
     { }
 
     void trace(JSTracer* trc);
   };
 
 private:
-  RefPtr<XMLHttpRequestUpload> mUpload;
+  RefPtr<XMLHttpRequestUploadWorker> mUpload;
   WorkerPrivate* mWorkerPrivate;
   RefPtr<Proxy> mProxy;
   XMLHttpRequestResponseType mResponseType;
   StateData mStateData;
 
   uint32_t mTimeout;
 
   bool mRooted;
@@ -155,17 +155,17 @@ public:
   MozBackgroundRequest() const
   {
     return mBackgroundRequest;
   }
 
   void
   SetMozBackgroundRequest(bool aBackgroundRequest, ErrorResult& aRv);
 
-  XMLHttpRequestUpload*
+  XMLHttpRequestUploadWorker*
   GetUpload(ErrorResult& aRv);
 
   void
   Send(ErrorResult& aRv);
 
   void
   Send(const nsAString& aBody, ErrorResult& aRv);
 
@@ -234,17 +234,17 @@ public:
 
   void
   GetInterface(JSContext* cx, JS::Handle<JSObject*> aIID,
                JS::MutableHandle<JS::Value> aRetval, ErrorResult& aRv)
   {
     aRv.Throw(NS_ERROR_FAILURE);
   }
 
-  XMLHttpRequestUpload*
+  XMLHttpRequestUploadWorker*
   GetUploadObjectNoCreate() const
   {
     return mUpload;
   }
 
   void
   UpdateState(const StateData& aStateData, bool aUseCachedArrayBufferResponse);
 
--- a/dom/workers/moz.build
+++ b/dom/workers/moz.build
@@ -34,17 +34,17 @@ EXPORTS.mozilla.dom.workers += [
 EXPORTS.mozilla.dom.workers.bindings += [
     'ServiceWorker.h',
     'ServiceWorkerClient.h',
     'ServiceWorkerClients.h',
     'ServiceWorkerWindowClient.h',
     'SharedWorker.h',
     'URL.h',
     'WorkerHolder.h',
-    'XMLHttpRequestUpload.h',
+    'XMLHttpRequestUploadWorker.h',
     'XMLHttpRequestWorker.h',
 ]
 
 XPIDL_MODULE = 'dom_workers'
 
 XPIDL_SOURCES += [
     'nsIWorkerDebugger.idl',
     'nsIWorkerDebuggerManager.idl',
@@ -84,17 +84,17 @@ UNIFIED_SOURCES += [
     'WorkerDebuggerManager.cpp',
     'WorkerHolder.cpp',
     'WorkerLocation.cpp',
     'WorkerNavigator.cpp',
     'WorkerPrivate.cpp',
     'WorkerRunnable.cpp',
     'WorkerScope.cpp',
     'WorkerThread.cpp',
-    'XMLHttpRequestUpload.cpp',
+    'XMLHttpRequestUploadWorker.cpp',
     'XMLHttpRequestWorker.cpp',
 ]
 
 IPDL_SOURCES += [
     'PServiceWorkerManager.ipdl',
     'ServiceWorkerRegistrarTypes.ipdlh',
 ]