| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 WTF_MAKE_FAST_ALLOCATED(WorkerLoaderClientBridgeSyncHelper); | 50 WTF_MAKE_FAST_ALLOCATED(WorkerLoaderClientBridgeSyncHelper); |
| 51 public: | 51 public: |
| 52 static PassOwnPtr<WorkerLoaderClientBridgeSyncHelper> create(ThreadableLoade
rClientWrapper*, PassOwnPtr<WebWaitableEvent>); | 52 static PassOwnPtr<WorkerLoaderClientBridgeSyncHelper> create(ThreadableLoade
rClientWrapper*, PassOwnPtr<WebWaitableEvent>); |
| 53 virtual ~WorkerLoaderClientBridgeSyncHelper(); | 53 ~WorkerLoaderClientBridgeSyncHelper() override; |
| 54 | 54 |
| 55 // Called on the worker context thread. | 55 // Called on the worker context thread. |
| 56 void run(); | 56 void run(); |
| 57 | 57 |
| 58 // Called on the main thread. | 58 // Called on the main thread. |
| 59 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) override; | 59 void didSendData(unsigned long long bytesSent, unsigned long long totalBytes
ToBeSent) override; |
| 60 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&, PassOwnPtr<WebDataConsumerHandle>) override; | 60 void didReceiveResponse(unsigned long identifier, const ResourceResponse&, P
assOwnPtr<WebDataConsumerHandle>) override; |
| 61 virtual void didReceiveData(const char*, unsigned dataLength) override; | 61 void didReceiveData(const char*, unsigned dataLength) override; |
| 62 virtual void didDownloadData(int dataLength) override; | 62 void didDownloadData(int dataLength) override; |
| 63 virtual void didReceiveCachedMetadata(const char*, int dataLength) override; | 63 void didReceiveCachedMetadata(const char*, int dataLength) override; |
| 64 virtual void didFinishLoading(unsigned long identifier, double finishTime) o
verride; | 64 void didFinishLoading(unsigned long identifier, double finishTime) override; |
| 65 virtual void didFail(const ResourceError&) override; | 65 void didFail(const ResourceError&) override; |
| 66 virtual void didFailAccessControlCheck(const ResourceError&) override; | 66 void didFailAccessControlCheck(const ResourceError&) override; |
| 67 virtual void didFailRedirectCheck() override; | 67 void didFailRedirectCheck() override; |
| 68 virtual void didReceiveResourceTiming(const ResourceTimingInfo&) override; | 68 void didReceiveResourceTiming(const ResourceTimingInfo&) override; |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 WorkerLoaderClientBridgeSyncHelper(ThreadableLoaderClientWrapper*, PassOwnPt
r<WebWaitableEvent>); | 71 WorkerLoaderClientBridgeSyncHelper(ThreadableLoaderClientWrapper*, PassOwnPt
r<WebWaitableEvent>); |
| 72 | 72 |
| 73 bool m_done; | 73 bool m_done; |
| 74 RefPtr<ThreadableLoaderClientWrapper> m_client; | 74 RefPtr<ThreadableLoaderClientWrapper> m_client; |
| 75 OwnPtr<WebWaitableEvent> m_event; | 75 OwnPtr<WebWaitableEvent> m_event; |
| 76 Vector<Vector<char>*> m_receivedData; | 76 Vector<Vector<char>*> m_receivedData; |
| 77 Vector<OwnPtr<Closure>> m_clientTasks; | 77 Vector<OwnPtr<Closure>> m_clientTasks; |
| 78 Mutex m_lock; | 78 Mutex m_lock; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace blink | 81 } // namespace blink |
| 82 | 82 |
| 83 #endif // WorkerLoaderClientBridgeSyncHelper_h | 83 #endif // WorkerLoaderClientBridgeSyncHelper_h |
| OLD | NEW |