OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WorkerLoaderClientBridgeSyncHelper_h | 31 #ifndef WorkerLoaderClientBridgeSyncHelper_h |
32 #define WorkerLoaderClientBridgeSyncHelper_h | 32 #define WorkerLoaderClientBridgeSyncHelper_h |
33 | 33 |
34 #include "core/loader/ThreadableLoaderClient.h" | 34 #include "core/loader/ThreadableLoaderClientWrapper.h" |
35 #include "wtf/Forward.h" | 35 #include "wtf/Forward.h" |
36 #include "wtf/Functional.h" | 36 #include "wtf/Functional.h" |
37 #include "wtf/ThreadingPrimitives.h" | 37 #include "wtf/ThreadingPrimitives.h" |
38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 class WebWaitableEvent; | 41 class WebWaitableEvent; |
42 } | 42 } |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 // This bridge is created and destroyed on the worker thread, but is | 46 // This bridge is created and destroyed on the worker thread, but is |
47 // passed to and used on the main thread. Each did* method records the given | 47 // passed to and used on the main thread. Each did* method records the given |
48 // data so that they can be run on the worker thread later (by run()). | 48 // data so that they can be run on the worker thread later (by run()). |
49 class WorkerLoaderClientBridgeSyncHelper : public ThreadableLoaderClient { | 49 class WorkerLoaderClientBridgeSyncHelper : public ThreadableLoaderClient { |
50 public: | 50 public: |
51 static PassOwnPtr<WorkerLoaderClientBridgeSyncHelper> create(ThreadableLoade
rClient&, PassOwnPtr<WebWaitableEvent>); | 51 static PassOwnPtr<WorkerLoaderClientBridgeSyncHelper> create(ThreadableLoade
rClientWrapper*, PassOwnPtr<WebWaitableEvent>); |
52 virtual ~WorkerLoaderClientBridgeSyncHelper(); | 52 virtual ~WorkerLoaderClientBridgeSyncHelper(); |
53 | 53 |
54 // Called on the worker context thread. | 54 // Called on the worker context thread. |
55 void run(); | 55 void run(); |
56 | 56 |
57 // Called on the main thread. | 57 // Called on the main thread. |
58 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) override; | 58 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) override; |
59 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&, PassOwnPtr<WebDataConsumerHandle>) override; | 59 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&, PassOwnPtr<WebDataConsumerHandle>) override; |
60 virtual void didReceiveData(const char*, unsigned dataLength) override; | 60 virtual void didReceiveData(const char*, unsigned dataLength) override; |
61 virtual void didDownloadData(int dataLength) override; | 61 virtual void didDownloadData(int dataLength) override; |
62 virtual void didReceiveCachedMetadata(const char*, int dataLength) override; | 62 virtual void didReceiveCachedMetadata(const char*, int dataLength) override; |
63 virtual void didFinishLoading(unsigned long identifier, double finishTime) o
verride; | 63 virtual void didFinishLoading(unsigned long identifier, double finishTime) o
verride; |
64 virtual void didFail(const ResourceError&) override; | 64 virtual void didFail(const ResourceError&) override; |
65 virtual void didFailAccessControlCheck(const ResourceError&) override; | 65 virtual void didFailAccessControlCheck(const ResourceError&) override; |
66 virtual void didFailRedirectCheck() override; | 66 virtual void didFailRedirectCheck() override; |
| 67 virtual void didReceiveResourceTiming(const ResourceTimingInfo&) override; |
67 | 68 |
68 private: | 69 private: |
69 WorkerLoaderClientBridgeSyncHelper(ThreadableLoaderClient&, PassOwnPtr<WebWa
itableEvent>); | 70 WorkerLoaderClientBridgeSyncHelper(ThreadableLoaderClientWrapper*, PassOwnPt
r<WebWaitableEvent>); |
70 | 71 |
71 bool m_done; | 72 bool m_done; |
72 ThreadableLoaderClient& m_client; | 73 RefPtr<ThreadableLoaderClientWrapper> m_client; |
73 OwnPtr<WebWaitableEvent> m_event; | 74 OwnPtr<WebWaitableEvent> m_event; |
74 Vector<Vector<char>*> m_receivedData; | 75 Vector<Vector<char>*> m_receivedData; |
75 Vector<OwnPtr<Closure>> m_clientTasks; | 76 Vector<OwnPtr<Closure>> m_clientTasks; |
76 Mutex m_lock; | 77 Mutex m_lock; |
77 }; | 78 }; |
78 | 79 |
79 } // namespace blink | 80 } // namespace blink |
80 | 81 |
81 #endif // WorkerLoaderClientBridgeSyncHelper_h | 82 #endif // WorkerLoaderClientBridgeSyncHelper_h |
OLD | NEW |