OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SimplexLoader_h |
| 6 #define SimplexLoader_h |
| 7 |
| 8 #include "core/fetch/ResourceLoaderOptions.h" |
| 9 #include "core/page/PageLifecycleObserver.h" |
| 10 #include "platform/Timer.h" |
| 11 #include "public/platform/WebURLLoaderClient.h" |
| 12 #include "wtf/Noncopyable.h" |
| 13 #include "wtf/RefPtr.h" |
| 14 |
| 15 namespace WebCore { |
| 16 |
| 17 class FormData; |
| 18 class LocalFrame; |
| 19 class KURL; |
| 20 class ResourceError; |
| 21 class ResourceHandle; |
| 22 class ResourceRequest; |
| 23 class ResourceResponse; |
| 24 |
| 25 // Issue an asynchronous, one-directional request at some resources, ignoring |
| 26 // any response. The request is made independent of any LocalFrame staying alive
, |
| 27 // and must only stay alive until the transmission has completed successfully |
| 28 // (or not -- errors are not propagated back either.) Upon transmission, the |
| 29 // the load is cancelled and the loader cancels itself. |
| 30 // |
| 31 // The simplex loader is used by both 'ping' and 'beacon' loaders to perform |
| 32 // their requests. |
| 33 // |
| 34 class SimplexLoader : public PageLifecycleObserver, private blink::WebURLLoaderC
lient { |
| 35 WTF_MAKE_NONCOPYABLE(SimplexLoader); |
| 36 WTF_MAKE_FAST_ALLOCATED; |
| 37 public: |
| 38 virtual ~SimplexLoader(); |
| 39 |
| 40 protected: |
| 41 SimplexLoader(LocalFrame*, ResourceRequest&, const FetchInitiatorInfo&, Stor
edCredentials); |
| 42 |
| 43 static void start(LocalFrame*, ResourceRequest&, const FetchInitiatorInfo&,
StoredCredentials = AllowStoredCredentials); |
| 44 |
| 45 private: |
| 46 virtual void didReceiveResponse(blink::WebURLLoader*, const blink::WebURLRes
ponse&) OVERRIDE; |
| 47 virtual void didReceiveData(blink::WebURLLoader*, const char*, int, int) OVE
RRIDE; |
| 48 virtual void didFinishLoading(blink::WebURLLoader*, double, int64_t) OVERRID
E; |
| 49 virtual void didFail(blink::WebURLLoader*, const blink::WebURLError&) OVERRI
DE; |
| 50 |
| 51 void timeout(Timer<SimplexLoader>*); |
| 52 |
| 53 OwnPtr<blink::WebURLLoader> m_loader; |
| 54 Timer<SimplexLoader> m_timeout; |
| 55 String m_url; |
| 56 unsigned long m_identifier; |
| 57 }; |
| 58 |
| 59 } |
| 60 |
| 61 #endif // SimplexLoader_h |
OLD | NEW |