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

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: s/WebScheduler.h/web_scheduler.h/ Created 3 years, 8 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) 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
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/scheduler/child/web_scheduler.h" 58 #include "platform/scheduler/child/web_scheduler.h"
57 #include "platform/weborigin/KURL.h" 59 #include "platform/weborigin/KURL.h"
58 #include "platform/weborigin/SecurityOrigin.h" 60 #include "platform/weborigin/SecurityOrigin.h"
59 #include "platform/wtf/Assertions.h" 61 #include "platform/wtf/Assertions.h"
60 #include "platform/wtf/RefPtr.h" 62 #include "platform/wtf/RefPtr.h"
61 #include "public/platform/Platform.h" 63 #include "public/platform/Platform.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
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::GetFetchContext() {
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 378 }
369 379
370 DEFINE_TRACE(WorkerGlobalScope) { 380 DEFINE_TRACE(WorkerGlobalScope) {
371 visitor->Trace(location_); 381 visitor->Trace(location_);
372 visitor->Trace(navigator_); 382 visitor->Trace(navigator_);
373 visitor->Trace(script_controller_); 383 visitor->Trace(script_controller_);
374 visitor->Trace(event_queue_); 384 visitor->Trace(event_queue_);
375 visitor->Trace(timers_); 385 visitor->Trace(timers_);
376 visitor->Trace(event_listeners_); 386 visitor->Trace(event_listeners_);
377 visitor->Trace(pending_error_events_); 387 visitor->Trace(pending_error_events_);
388 visitor->Trace(fetch_context_);
378 ExecutionContext::Trace(visitor); 389 ExecutionContext::Trace(visitor);
379 EventTargetWithInlineData::Trace(visitor); 390 EventTargetWithInlineData::Trace(visitor);
380 SecurityContext::Trace(visitor); 391 SecurityContext::Trace(visitor);
381 Supplementable<WorkerGlobalScope>::Trace(visitor); 392 Supplementable<WorkerGlobalScope>::Trace(visitor);
382 } 393 }
383 394
384 } // namespace blink 395 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698