Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Unified Diff: Source/core/dom/DOMURLUtils.h

Issue 143313002: Implement URLSearchParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More tests + ref count unattached URLSearchParams objects Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/DOMURLUtils.h
diff --git a/Source/core/dom/DOMURLUtils.h b/Source/core/dom/DOMURLUtils.h
index 1987ecd72054e349d44a522bd9b4a50143f0e906..55abfc5f55a2e9573b7aa2778f162df111fc5857 100644
--- a/Source/core/dom/DOMURLUtils.h
+++ b/Source/core/dom/DOMURLUtils.h
@@ -27,12 +27,15 @@
#ifndef DOMURLUtils_h
#define DOMURLUtils_h
+#include "core/dom/DOMURLSearchParams.h"
#include "core/dom/DOMURLUtilsReadOnly.h"
#include "wtf/Forward.h"
+#include "wtf/OwnPtr.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
+class ExceptionState;
class KURL;
class DOMURLUtils : public DOMURLUtilsReadOnly {
@@ -52,6 +55,38 @@ public:
static void setPathname(DOMURLUtils*, const String&);
static void setSearch(DOMURLUtils*, const String&);
static void setHash(DOMURLUtils*, const String&);
+
+ static DOMURLSearchParams* searchParams(DOMURLUtils*);
+ static void setSearchParams(DOMURLUtils*, DOMURLSearchParams*, ExceptionState&);
+
+ static void update(DOMURLUtils*);
+
+ // To correctly record object dependencies during GCs, we have to
+ // map from a URLSearchParams' url object (a DOMURLUtils pointer)
+ // to its corresponding wrapper object - the wrapper object for
+ // the concrete type implementing the URLUtils interface.
+ //
+ // Indirectly (and pragmatically) express such type discovery via
+ // an enum. If the URLUtils interface is implemented by another
+ // object, and it doesn't fit with one of the below, the type will
+ // have to be extended. (Along with the custom wrapper function
+ // that considers its value.)
+ enum ImplementedBy {
+ Anchor, // derives from HTMLAnchorElement
+ DomURL
+ };
+
+ virtual ImplementedBy implementedBy() const = 0;
+
+protected:
+ static void createSearchParams(DOMURLUtils*, const String&);
+ static void updateSearchParams(DOMURLUtils*, const String&);
+
+ friend class DOMURLSearchParams;
+ virtual void refURLUtils() = 0;
+ virtual void derefURLUtils() = 0;
+
+ OwnPtr<DOMURLSearchParams> m_searchParams;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698