Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef mozilla_dom_workers_location_h__ |
michael@0 | 7 | #define mozilla_dom_workers_location_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "Workers.h" |
michael@0 | 10 | #include "WorkerPrivate.h" |
michael@0 | 11 | #include "nsWrapperCache.h" |
michael@0 | 12 | |
michael@0 | 13 | BEGIN_WORKERS_NAMESPACE |
michael@0 | 14 | |
michael@0 | 15 | class WorkerLocation MOZ_FINAL : public nsWrapperCache |
michael@0 | 16 | { |
michael@0 | 17 | nsString mHref; |
michael@0 | 18 | nsString mProtocol; |
michael@0 | 19 | nsString mHost; |
michael@0 | 20 | nsString mHostname; |
michael@0 | 21 | nsString mPort; |
michael@0 | 22 | nsString mPathname; |
michael@0 | 23 | nsString mSearch; |
michael@0 | 24 | nsString mHash; |
michael@0 | 25 | nsString mOrigin; |
michael@0 | 26 | |
michael@0 | 27 | WorkerLocation(const nsAString& aHref, |
michael@0 | 28 | const nsAString& aProtocol, |
michael@0 | 29 | const nsAString& aHost, |
michael@0 | 30 | const nsAString& aHostname, |
michael@0 | 31 | const nsAString& aPort, |
michael@0 | 32 | const nsAString& aPathname, |
michael@0 | 33 | const nsAString& aSearch, |
michael@0 | 34 | const nsAString& aHash, |
michael@0 | 35 | const nsAString& aOrigin) |
michael@0 | 36 | : mHref(aHref) |
michael@0 | 37 | , mProtocol(aProtocol) |
michael@0 | 38 | , mHost(aHost) |
michael@0 | 39 | , mHostname(aHostname) |
michael@0 | 40 | , mPort(aPort) |
michael@0 | 41 | , mPathname(aPathname) |
michael@0 | 42 | , mSearch(aSearch) |
michael@0 | 43 | , mHash(aHash) |
michael@0 | 44 | , mOrigin(aOrigin) |
michael@0 | 45 | { |
michael@0 | 46 | MOZ_COUNT_CTOR(WorkerLocation); |
michael@0 | 47 | SetIsDOMBinding(); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | public: |
michael@0 | 51 | |
michael@0 | 52 | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WorkerLocation) |
michael@0 | 53 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WorkerLocation) |
michael@0 | 54 | |
michael@0 | 55 | static already_AddRefed<WorkerLocation> |
michael@0 | 56 | Create(WorkerPrivate::LocationInfo& aInfo); |
michael@0 | 57 | |
michael@0 | 58 | virtual JSObject* |
michael@0 | 59 | WrapObject(JSContext* aCx) MOZ_OVERRIDE; |
michael@0 | 60 | |
michael@0 | 61 | nsISupports* GetParentObject() const { |
michael@0 | 62 | return nullptr; |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | ~WorkerLocation() |
michael@0 | 66 | { |
michael@0 | 67 | MOZ_COUNT_DTOR(WorkerLocation); |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | void Stringify(nsString& aHref) const |
michael@0 | 71 | { |
michael@0 | 72 | aHref = mHref; |
michael@0 | 73 | } |
michael@0 | 74 | void GetHref(nsString& aHref) const |
michael@0 | 75 | { |
michael@0 | 76 | aHref = mHref; |
michael@0 | 77 | } |
michael@0 | 78 | void GetProtocol(nsString& aProtocol) const |
michael@0 | 79 | { |
michael@0 | 80 | aProtocol = mProtocol; |
michael@0 | 81 | } |
michael@0 | 82 | void GetHost(nsString& aHost) const |
michael@0 | 83 | { |
michael@0 | 84 | aHost = mHost; |
michael@0 | 85 | } |
michael@0 | 86 | void GetHostname(nsString& aHostname) const |
michael@0 | 87 | { |
michael@0 | 88 | aHostname = mHostname; |
michael@0 | 89 | } |
michael@0 | 90 | void GetPort(nsString& aPort) const |
michael@0 | 91 | { |
michael@0 | 92 | aPort = mPort; |
michael@0 | 93 | } |
michael@0 | 94 | void GetPathname(nsString& aPathname) const |
michael@0 | 95 | { |
michael@0 | 96 | aPathname = mPathname; |
michael@0 | 97 | } |
michael@0 | 98 | void GetSearch(nsString& aSearch) const |
michael@0 | 99 | { |
michael@0 | 100 | aSearch = mSearch; |
michael@0 | 101 | } |
michael@0 | 102 | void GetHash(nsString& aHash) const |
michael@0 | 103 | { |
michael@0 | 104 | aHash = mHash; |
michael@0 | 105 | } |
michael@0 | 106 | void GetOrigin(nsString& aOrigin) const |
michael@0 | 107 | { |
michael@0 | 108 | aOrigin = mOrigin; |
michael@0 | 109 | } |
michael@0 | 110 | }; |
michael@0 | 111 | |
michael@0 | 112 | END_WORKERS_NAMESPACE |
michael@0 | 113 | |
michael@0 | 114 | #endif // mozilla_dom_workers_location_h__ |