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 30 matching lines...) Expand all Loading... |
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<blink::WebWaitableEvent>); | 51 static PassOwnPtr<WorkerLoaderClientBridgeSyncHelper> create(ThreadableLoade
rClient&, 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 | 67 |
68 private: | 68 private: |
69 WorkerLoaderClientBridgeSyncHelper(ThreadableLoaderClient&, PassOwnPtr<blink
::WebWaitableEvent>); | 69 WorkerLoaderClientBridgeSyncHelper(ThreadableLoaderClient&, PassOwnPtr<WebWa
itableEvent>); |
70 | 70 |
71 bool m_done; | 71 bool m_done; |
72 ThreadableLoaderClient& m_client; | 72 ThreadableLoaderClient& m_client; |
73 OwnPtr<blink::WebWaitableEvent> m_event; | 73 OwnPtr<WebWaitableEvent> m_event; |
74 Vector<Vector<char>*> m_receivedData; | 74 Vector<Vector<char>*> m_receivedData; |
75 Vector<OwnPtr<Closure>> m_clientTasks; | 75 Vector<OwnPtr<Closure>> m_clientTasks; |
76 Mutex m_lock; | 76 Mutex m_lock; |
77 }; | 77 }; |
78 | 78 |
79 } // namespace blink | 79 } // namespace blink |
80 | 80 |
81 #endif // WorkerLoaderClientBridgeSyncHelper_h | 81 #endif // WorkerLoaderClientBridgeSyncHelper_h |
OLD | NEW |