OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return adoptPtr(new Loader()); | 67 return adoptPtr(new Loader()); |
68 } | 68 } |
69 | 69 |
70 virtual ~Loader() | 70 virtual ~Loader() |
71 { | 71 { |
72 m_scriptLoader->setClient(0); | 72 m_scriptLoader->setClient(0); |
73 } | 73 } |
74 | 74 |
75 void load(ExecutionContext* loadingContext, const KURL& scriptURL, const Clo
sure& callback) | 75 void load(ExecutionContext* loadingContext, const KURL& scriptURL, const Clo
sure& callback) |
76 { | 76 { |
| 77 ASSERT(loadingContext); |
77 m_callback = callback; | 78 m_callback = callback; |
78 m_scriptLoader->setTargetType(ResourceRequest::TargetIsServiceWorker); | 79 m_scriptLoader->setTargetType(ResourceRequest::TargetIsServiceWorker); |
79 m_scriptLoader->loadAsynchronously( | 80 m_scriptLoader->loadAsynchronously( |
80 loadingContext, scriptURL, DenyCrossOriginRequests, this); | 81 *loadingContext, scriptURL, DenyCrossOriginRequests, this); |
81 } | 82 } |
82 | 83 |
83 virtual void notifyFinished() OVERRIDE | 84 virtual void notifyFinished() OVERRIDE |
84 { | 85 { |
85 m_callback(); | 86 m_callback(); |
86 } | 87 } |
87 | 88 |
88 void cancel() | 89 void cancel() |
89 { | 90 { |
90 m_scriptLoader->cancel(); | 91 m_scriptLoader->cancel(); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 m_mainScriptLoader.clear(); | 265 m_mainScriptLoader.clear(); |
265 | 266 |
266 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW
ebFrameImpl(m_mainFrame)->frame()->document(), *contextClient); | 267 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW
ebFrameImpl(m_mainFrame)->frame()->document(), *contextClient); |
267 m_loaderProxy = LoaderProxy::create(*this); | 268 m_loaderProxy = LoaderProxy::create(*this); |
268 | 269 |
269 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); | 270 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); |
270 m_workerThread->start(); | 271 m_workerThread->start(); |
271 } | 272 } |
272 | 273 |
273 } // namespace blink | 274 } // namespace blink |
OLD | NEW |