OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "bindings/core/v8/V8AbstractEventListener.h" | 33 #include "bindings/core/v8/V8AbstractEventListener.h" |
34 #include "core/dom/ContextLifecycleNotifier.h" | 34 #include "core/dom/ContextLifecycleNotifier.h" |
35 #include "core/dom/ExceptionCode.h" | 35 #include "core/dom/ExceptionCode.h" |
36 #include "core/dom/SuspendableObject.h" | 36 #include "core/dom/SuspendableObject.h" |
37 #include "core/events/ErrorEvent.h" | 37 #include "core/events/ErrorEvent.h" |
38 #include "core/events/Event.h" | 38 #include "core/events/Event.h" |
39 #include "core/frame/DOMTimerCoordinator.h" | 39 #include "core/frame/DOMTimerCoordinator.h" |
40 #include "core/inspector/ConsoleMessage.h" | 40 #include "core/inspector/ConsoleMessage.h" |
41 #include "core/inspector/ConsoleMessageStorage.h" | 41 #include "core/inspector/ConsoleMessageStorage.h" |
42 #include "core/inspector/WorkerThreadDebugger.h" | 42 #include "core/inspector/WorkerThreadDebugger.h" |
| 43 #include "core/loader/WorkerFetchContext.h" |
43 #include "core/loader/WorkerThreadableLoader.h" | 44 #include "core/loader/WorkerThreadableLoader.h" |
44 #include "core/probe/CoreProbes.h" | 45 #include "core/probe/CoreProbes.h" |
45 #include "core/workers/WorkerClients.h" | 46 #include "core/workers/WorkerClients.h" |
46 #include "core/workers/WorkerLoaderProxy.h" | 47 #include "core/workers/WorkerLoaderProxy.h" |
47 #include "core/workers/WorkerLocation.h" | 48 #include "core/workers/WorkerLocation.h" |
48 #include "core/workers/WorkerNavigator.h" | 49 #include "core/workers/WorkerNavigator.h" |
49 #include "core/workers/WorkerReportingProxy.h" | 50 #include "core/workers/WorkerReportingProxy.h" |
50 #include "core/workers/WorkerScriptLoader.h" | 51 #include "core/workers/WorkerScriptLoader.h" |
51 #include "core/workers/WorkerThread.h" | 52 #include "core/workers/WorkerThread.h" |
52 #include "platform/CrossThreadFunctional.h" | 53 #include "platform/CrossThreadFunctional.h" |
53 #include "platform/InstanceCounters.h" | 54 #include "platform/InstanceCounters.h" |
| 55 #include "platform/RuntimeEnabledFeatures.h" |
54 #include "platform/loader/fetch/MemoryCache.h" | 56 #include "platform/loader/fetch/MemoryCache.h" |
55 #include "platform/network/ContentSecurityPolicyParsers.h" | 57 #include "platform/network/ContentSecurityPolicyParsers.h" |
56 #include "platform/weborigin/KURL.h" | 58 #include "platform/weborigin/KURL.h" |
57 #include "platform/weborigin/SecurityOrigin.h" | 59 #include "platform/weborigin/SecurityOrigin.h" |
58 #include "platform/wtf/Assertions.h" | 60 #include "platform/wtf/Assertions.h" |
59 #include "platform/wtf/RefPtr.h" | 61 #include "platform/wtf/RefPtr.h" |
60 #include "public/platform/Platform.h" | 62 #include "public/platform/Platform.h" |
61 #include "public/platform/WebScheduler.h" | 63 #include "public/platform/WebScheduler.h" |
62 #include "public/platform/WebURLRequest.h" | 64 #include "public/platform/WebURLRequest.h" |
63 | 65 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 if (GetSecurityOrigin()->IsPotentiallyTrustworthy()) | 295 if (GetSecurityOrigin()->IsPotentiallyTrustworthy()) |
294 return true; | 296 return true; |
295 error_message = GetSecurityOrigin()->IsPotentiallyTrustworthyErrorMessage(); | 297 error_message = GetSecurityOrigin()->IsPotentiallyTrustworthyErrorMessage(); |
296 return false; | 298 return false; |
297 } | 299 } |
298 | 300 |
299 ExecutionContext* WorkerGlobalScope::GetExecutionContext() const { | 301 ExecutionContext* WorkerGlobalScope::GetExecutionContext() const { |
300 return const_cast<WorkerGlobalScope*>(this); | 302 return const_cast<WorkerGlobalScope*>(this); |
301 } | 303 } |
302 | 304 |
| 305 WorkerFetchContext* WorkerGlobalScope::FetchContext() { |
| 306 DCHECK(RuntimeEnabledFeatures::offMainThreadFetchEnabled()); |
| 307 if (fetch_context_) |
| 308 return fetch_context_; |
| 309 fetch_context_ = WorkerFetchContext::Create(*this); |
| 310 return fetch_context_; |
| 311 } |
| 312 |
303 WorkerGlobalScope::WorkerGlobalScope( | 313 WorkerGlobalScope::WorkerGlobalScope( |
304 const KURL& url, | 314 const KURL& url, |
305 const String& user_agent, | 315 const String& user_agent, |
306 WorkerThread* thread, | 316 WorkerThread* thread, |
307 double time_origin, | 317 double time_origin, |
308 std::unique_ptr<SecurityOrigin::PrivilegeData> | 318 std::unique_ptr<SecurityOrigin::PrivilegeData> |
309 starter_origin_privilage_data, | 319 starter_origin_privilage_data, |
310 WorkerClients* worker_clients) | 320 WorkerClients* worker_clients) |
311 : url_(url), | 321 : url_(url), |
312 user_agent_(user_agent), | 322 user_agent_(user_agent), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 379 } |
370 | 380 |
371 DEFINE_TRACE(WorkerGlobalScope) { | 381 DEFINE_TRACE(WorkerGlobalScope) { |
372 visitor->Trace(location_); | 382 visitor->Trace(location_); |
373 visitor->Trace(navigator_); | 383 visitor->Trace(navigator_); |
374 visitor->Trace(script_controller_); | 384 visitor->Trace(script_controller_); |
375 visitor->Trace(event_queue_); | 385 visitor->Trace(event_queue_); |
376 visitor->Trace(timers_); | 386 visitor->Trace(timers_); |
377 visitor->Trace(event_listeners_); | 387 visitor->Trace(event_listeners_); |
378 visitor->Trace(pending_error_events_); | 388 visitor->Trace(pending_error_events_); |
| 389 visitor->Trace(fetch_context_); |
379 ExecutionContext::Trace(visitor); | 390 ExecutionContext::Trace(visitor); |
380 EventTargetWithInlineData::Trace(visitor); | 391 EventTargetWithInlineData::Trace(visitor); |
381 SecurityContext::Trace(visitor); | 392 SecurityContext::Trace(visitor); |
382 Supplementable<WorkerGlobalScope>::Trace(visitor); | 393 Supplementable<WorkerGlobalScope>::Trace(visitor); |
383 } | 394 } |
384 | 395 |
385 } // namespace blink | 396 } // namespace blink |
OLD | NEW |