Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: Source/core/loader/WorkerLoaderClientBridge.cpp

Issue 1184403003: Offer Resource Timing in workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: style fix Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/loader/WorkerLoaderClientBridge.h" 32 #include "core/loader/WorkerLoaderClientBridge.h"
33 33
34 #include "core/dom/CrossThreadTask.h" 34 #include "core/dom/CrossThreadTask.h"
35 #include "core/loader/ThreadableLoaderClientWrapper.h" 35 #include "core/loader/ThreadableLoaderClientWrapper.h"
36 #include "core/workers/WorkerGlobalScope.h" 36 #include "core/workers/WorkerGlobalScope.h"
37 #include "core/workers/WorkerLoaderProxy.h" 37 #include "core/workers/WorkerLoaderProxy.h"
38 #include "platform/network/ResourceError.h" 38 #include "platform/network/ResourceError.h"
39 #include "platform/network/ResourceResponse.h" 39 #include "platform/network/ResourceResponse.h"
40 #include "platform/network/ResourceTimingInfo.h"
40 #include "wtf/PassOwnPtr.h" 41 #include "wtf/PassOwnPtr.h"
41 #include "wtf/PassRefPtr.h" 42 #include "wtf/PassRefPtr.h"
42 #include <limits> 43 #include <limits>
43 44
44 namespace blink { 45 namespace blink {
45 46
46 PassOwnPtr<ThreadableLoaderClient> WorkerLoaderClientBridge::create(PassRefPtr<T hreadableLoaderClientWrapper> client, PassRefPtr<WorkerLoaderProxy> loaderProxy) 47 PassOwnPtr<ThreadableLoaderClient> WorkerLoaderClientBridge::create(PassRefPtr<T hreadableLoaderClientWrapper> client, PassRefPtr<WorkerLoaderProxy> loaderProxy)
47 { 48 {
48 return adoptPtr(new WorkerLoaderClientBridge(client, loaderProxy)); 49 return adoptPtr(new WorkerLoaderClientBridge(client, loaderProxy));
49 } 50 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 { 151 {
151 ASSERT_UNUSED(context, context->isWorkerGlobalScope()); 152 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
152 workerClientWrapper->didFailRedirectCheck(); 153 workerClientWrapper->didFailRedirectCheck();
153 } 154 }
154 155
155 void WorkerLoaderClientBridge::didFailRedirectCheck() 156 void WorkerLoaderClientBridge::didFailRedirectCheck()
156 { 157 {
157 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob alScopeDidFailRedirectCheck, m_workerClientWrapper)); 158 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob alScopeDidFailRedirectCheck, m_workerClientWrapper));
158 } 159 }
159 160
161 static void workerGlobalScopeReportResourceTiming(PassRefPtr<ThreadableLoaderCli entWrapper> workerClientWrapper, PassOwnPtr<CrossThreadResourceTimingInfoData> t imingData, ExecutionContext* context)
162 {
163 ASSERT_UNUSED(context, context->isWorkerGlobalScope());
164 OwnPtr<ResourceTimingInfo> info(ResourceTimingInfo::adopt(timingData));
165 workerClientWrapper->didReceiveResourceTiming(*info);
166 }
167
168 void WorkerLoaderClientBridge::didReceiveResourceTiming(const ResourceTimingInfo & info)
169 {
170 m_loaderProxy->postTaskToWorkerGlobalScope(createCrossThreadTask(&workerGlob alScopeReportResourceTiming, m_workerClientWrapper, info));
171 }
172
160 WorkerLoaderClientBridge::WorkerLoaderClientBridge(PassRefPtr<ThreadableLoaderCl ientWrapper> clientWrapper, PassRefPtr<WorkerLoaderProxy> loaderProxy) 173 WorkerLoaderClientBridge::WorkerLoaderClientBridge(PassRefPtr<ThreadableLoaderCl ientWrapper> clientWrapper, PassRefPtr<WorkerLoaderProxy> loaderProxy)
161 : m_workerClientWrapper(clientWrapper) 174 : m_workerClientWrapper(clientWrapper)
162 , m_loaderProxy(loaderProxy) 175 , m_loaderProxy(loaderProxy)
163 { 176 {
164 } 177 }
165 178
166 } // namespace blink 179 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/WorkerLoaderClientBridge.h ('k') | Source/core/loader/WorkerLoaderClientBridgeSyncHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698