| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); | 68 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
| 69 OwnPtr<ResourceResponse> response(ResourceResponse::adopt(responseData)); | 69 OwnPtr<ResourceResponse> response(ResourceResponse::adopt(responseData)); |
| 70 workerClientWrapper->didReceiveResponse(identifier, *response, handle); | 70 workerClientWrapper->didReceiveResponse(identifier, *response, handle); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void WorkerLoaderClientBridge::didReceiveResponse(unsigned long identifier, cons
t ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) | 73 void WorkerLoaderClientBridge::didReceiveResponse(unsigned long identifier, cons
t ResourceResponse& response, PassOwnPtr<WebDataConsumerHandle> handle) |
| 74 { | 74 { |
| 75 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidReceiveResponse, m_workerClientWrapper, identifier, response, handle))
; | 75 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidReceiveResponse, m_workerClientWrapper, identifier, response, handle))
; |
| 76 } | 76 } |
| 77 | 77 |
| 78 static void workerGlobalScopeDidReceiveData(ExecutionContext* context, PassRefPt
r<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char> >
vectorData) | 78 static void workerGlobalScopeDidReceiveData(ExecutionContext* context, PassRefPt
r<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char>> v
ectorData) |
| 79 { | 79 { |
| 80 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); | 80 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
| 81 RELEASE_ASSERT(vectorData->size() <= std::numeric_limits<unsigned>::max()); | 81 RELEASE_ASSERT(vectorData->size() <= std::numeric_limits<unsigned>::max()); |
| 82 workerClientWrapper->didReceiveData(vectorData->data(), vectorData->size()); | 82 workerClientWrapper->didReceiveData(vectorData->data(), vectorData->size()); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void WorkerLoaderClientBridge::didReceiveData(const char* data, unsigned dataLen
gth) | 85 void WorkerLoaderClientBridge::didReceiveData(const char* data, unsigned dataLen
gth) |
| 86 { | 86 { |
| 87 OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(dataLength)); // ne
eds to be an OwnPtr for usage with createCrossThreadTask. | 87 OwnPtr<Vector<char>> vector = adoptPtr(new Vector<char>(dataLength)); // nee
ds to be an OwnPtr for usage with createCrossThreadTask. |
| 88 memcpy(vector->data(), data, dataLength); | 88 memcpy(vector->data(), data, dataLength); |
| 89 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidReceiveData, m_workerClientWrapper, vector.release())); | 89 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidReceiveData, m_workerClientWrapper, vector.release())); |
| 90 } | 90 } |
| 91 | 91 |
| 92 static void workerGlobalScopeDidDownloadData(ExecutionContext* context, PassRefP
tr<ThreadableLoaderClientWrapper> workerClientWrapper, int dataLength) | 92 static void workerGlobalScopeDidDownloadData(ExecutionContext* context, PassRefP
tr<ThreadableLoaderClientWrapper> workerClientWrapper, int dataLength) |
| 93 { | 93 { |
| 94 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); | 94 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
| 95 workerClientWrapper->didDownloadData(dataLength); | 95 workerClientWrapper->didDownloadData(dataLength); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void WorkerLoaderClientBridge::didDownloadData(int dataLength) | 98 void WorkerLoaderClientBridge::didDownloadData(int dataLength) |
| 99 { | 99 { |
| 100 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidDownloadData, m_workerClientWrapper, dataLength)); | 100 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidDownloadData, m_workerClientWrapper, dataLength)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 static void workerGlobalScopeDidReceiveCachedMetadata(ExecutionContext* context,
PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vecto
r<char> > vectorData) | 103 static void workerGlobalScopeDidReceiveCachedMetadata(ExecutionContext* context,
PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vecto
r<char>> vectorData) |
| 104 { | 104 { |
| 105 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); | 105 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
| 106 workerClientWrapper->didReceiveCachedMetadata(vectorData->data(), vectorData
->size()); | 106 workerClientWrapper->didReceiveCachedMetadata(vectorData->data(), vectorData
->size()); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void WorkerLoaderClientBridge::didReceiveCachedMetadata(const char* data, int da
taLength) | 109 void WorkerLoaderClientBridge::didReceiveCachedMetadata(const char* data, int da
taLength) |
| 110 { | 110 { |
| 111 OwnPtr<Vector<char> > vector = adoptPtr(new Vector<char>(dataLength)); // ne
eds to be an OwnPtr for usage with createCrossThreadTask. | 111 OwnPtr<Vector<char>> vector = adoptPtr(new Vector<char>(dataLength)); // nee
ds to be an OwnPtr for usage with createCrossThreadTask. |
| 112 memcpy(vector->data(), data, dataLength); | 112 memcpy(vector->data(), data, dataLength); |
| 113 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidReceiveCachedMetadata, m_workerClientWrapper, vector.release())); | 113 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidReceiveCachedMetadata, m_workerClientWrapper, vector.release())); |
| 114 } | 114 } |
| 115 | 115 |
| 116 static void workerGlobalScopeDidFinishLoading(ExecutionContext* context, PassRef
Ptr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier
, double finishTime) | 116 static void workerGlobalScopeDidFinishLoading(ExecutionContext* context, PassRef
Ptr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier
, double finishTime) |
| 117 { | 117 { |
| 118 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); | 118 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); |
| 119 workerClientWrapper->didFinishLoading(identifier, finishTime); | 119 workerClientWrapper->didFinishLoading(identifier, finishTime); |
| 120 } | 120 } |
| 121 | 121 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidFailRedirectCheck, m_workerClientWrapper)); | 157 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob
alScopeDidFailRedirectCheck, m_workerClientWrapper)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 WorkerLoaderClientBridge::WorkerLoaderClientBridge(PassRefPtr<ThreadableLoaderCl
ientWrapper> clientWrapper, PassRefPtr<WorkerLoaderProxy> loaderProxy) | 160 WorkerLoaderClientBridge::WorkerLoaderClientBridge(PassRefPtr<ThreadableLoaderCl
ientWrapper> clientWrapper, PassRefPtr<WorkerLoaderProxy> loaderProxy) |
| 161 : m_workerClientWrapper(clientWrapper) | 161 : m_workerClientWrapper(clientWrapper) |
| 162 , m_loaderProxy(loaderProxy) | 162 , m_loaderProxy(loaderProxy) |
| 163 { | 163 { |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace blink | 166 } // namespace blink |
| OLD | NEW |