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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class ThreadableLoaderClientWrapper; | 40 class ThreadableLoaderClientWrapper; |
41 class WorkerLoaderProxy; | 41 class WorkerLoaderProxy; |
42 | 42 |
43 // This bridge is created and destroyed on the worker thread, but is | 43 // This bridge is created and destroyed on the worker thread, but is |
44 // passed to and used on the main thread. Each did* method relays the given | 44 // passed to and used on the main thread. Each did* method relays the given |
45 // data to the client wrapper on the worker context thread. | 45 // data to the client wrapper on the worker context thread. |
46 class WorkerLoaderClientBridge : public ThreadableLoaderClient { | 46 class WorkerLoaderClientBridge : public ThreadableLoaderClient { |
| 47 WTF_MAKE_FAST_ALLOCATED(WorkerLoaderClientBridge); |
47 public: | 48 public: |
48 static PassOwnPtr<ThreadableLoaderClient> create(PassRefPtr<ThreadableLoader
ClientWrapper>, PassRefPtr<WorkerLoaderProxy>); | 49 static PassOwnPtr<ThreadableLoaderClient> create(PassRefPtr<ThreadableLoader
ClientWrapper>, PassRefPtr<WorkerLoaderProxy>); |
49 virtual ~WorkerLoaderClientBridge(); | 50 virtual ~WorkerLoaderClientBridge(); |
50 | 51 |
51 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) override; | 52 virtual void didSendData(unsigned long long bytesSent, unsigned long long to
talBytesToBeSent) override; |
52 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&, PassOwnPtr<WebDataConsumerHandle>) override; | 53 virtual void didReceiveResponse(unsigned long identifier, const ResourceResp
onse&, PassOwnPtr<WebDataConsumerHandle>) override; |
53 virtual void didReceiveData(const char*, unsigned dataLength) override; | 54 virtual void didReceiveData(const char*, unsigned dataLength) override; |
54 virtual void didDownloadData(int dataLength) override; | 55 virtual void didDownloadData(int dataLength) override; |
55 virtual void didReceiveCachedMetadata(const char*, int dataLength) override; | 56 virtual void didReceiveCachedMetadata(const char*, int dataLength) override; |
56 virtual void didFinishLoading(unsigned long identifier, double finishTime) o
verride; | 57 virtual void didFinishLoading(unsigned long identifier, double finishTime) o
verride; |
57 virtual void didFail(const ResourceError&) override; | 58 virtual void didFail(const ResourceError&) override; |
58 virtual void didFailAccessControlCheck(const ResourceError&) override; | 59 virtual void didFailAccessControlCheck(const ResourceError&) override; |
59 virtual void didFailRedirectCheck() override; | 60 virtual void didFailRedirectCheck() override; |
60 virtual void didReceiveResourceTiming(const ResourceTimingInfo&) override; | 61 virtual void didReceiveResourceTiming(const ResourceTimingInfo&) override; |
61 | 62 |
62 private: | 63 private: |
63 WorkerLoaderClientBridge(PassRefPtr<ThreadableLoaderClientWrapper>, PassRefP
tr<WorkerLoaderProxy>); | 64 WorkerLoaderClientBridge(PassRefPtr<ThreadableLoaderClientWrapper>, PassRefP
tr<WorkerLoaderProxy>); |
64 | 65 |
65 // Used on the worker context thread, while its refcounting is done on | 66 // Used on the worker context thread, while its refcounting is done on |
66 // either thread. | 67 // either thread. |
67 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; | 68 RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; |
68 | 69 |
69 RefPtr<WorkerLoaderProxy> m_loaderProxy; | 70 RefPtr<WorkerLoaderProxy> m_loaderProxy; |
70 }; | 71 }; |
71 | 72 |
72 } // namespace blink | 73 } // namespace blink |
73 | 74 |
74 #endif // WorkerLoaderClientBridge_h | 75 #endif // WorkerLoaderClientBridge_h |
OLD | NEW |