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

Unified Diff: Source/core/loader/SimplexLoader.h

Issue 232053005: Implement navigator.sendBeacon() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adjust unrelated test expectation Created 6 years, 8 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/loader/SimplexLoader.h
diff --git a/Source/core/loader/SimplexLoader.h b/Source/core/loader/SimplexLoader.h
new file mode 100644
index 0000000000000000000000000000000000000000..f54806c8782b6daf08ef2e11612dcfaa839bd675
--- /dev/null
+++ b/Source/core/loader/SimplexLoader.h
@@ -0,0 +1,61 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SimplexLoader_h
+#define SimplexLoader_h
+
+#include "core/fetch/ResourceLoaderOptions.h"
+#include "core/page/PageLifecycleObserver.h"
+#include "platform/Timer.h"
+#include "public/platform/WebURLLoaderClient.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class FormData;
+class LocalFrame;
+class KURL;
+class ResourceError;
+class ResourceHandle;
+class ResourceRequest;
+class ResourceResponse;
+
+// Issue an asynchronous, one-directional request at some resources, ignoring
+// any response. The request is made independent of any LocalFrame staying alive,
+// and must only stay alive until the transmission has completed successfully
+// (or not -- errors are not propagated back either.) Upon transmission, the
+// the load is cancelled and the loader cancels itself.
+//
+// The simplex loader is used by both 'ping' and 'beacon' loaders to perform
+// their requests.
+//
+class SimplexLoader : public PageLifecycleObserver, private blink::WebURLLoaderClient {
+ WTF_MAKE_NONCOPYABLE(SimplexLoader);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ virtual ~SimplexLoader();
+
+protected:
+ SimplexLoader(LocalFrame*, ResourceRequest&, const FetchInitiatorInfo&, StoredCredentials);
+
+ static void start(LocalFrame*, ResourceRequest&, const FetchInitiatorInfo&, StoredCredentials = AllowStoredCredentials);
+
+private:
+ virtual void didReceiveResponse(blink::WebURLLoader*, const blink::WebURLResponse&) OVERRIDE;
+ virtual void didReceiveData(blink::WebURLLoader*, const char*, int, int) OVERRIDE;
+ virtual void didFinishLoading(blink::WebURLLoader*, double, int64_t) OVERRIDE;
+ virtual void didFail(blink::WebURLLoader*, const blink::WebURLError&) OVERRIDE;
+
+ void timeout(Timer<SimplexLoader>*);
+
+ OwnPtr<blink::WebURLLoader> m_loader;
+ Timer<SimplexLoader> m_timeout;
+ String m_url;
+ unsigned long m_identifier;
+};
+
+}
+
+#endif // SimplexLoader_h

Powered by Google App Engine
This is Rietveld 408576698