| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/workers/MainThreadWorklet.h" | 5 #include "core/workers/MainThreadWorklet.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "bindings/core/v8/ScriptSourceCode.h" | 8 #include "bindings/core/v8/ScriptSourceCode.h" |
| 9 #include "bindings/core/v8/V8BindingForCore.h" | 9 #include "bindings/core/v8/V8BindingForCore.h" |
| 10 #include "core/dom/TaskRunnerHelper.h" | 10 #include "core/dom/TaskRunnerHelper.h" |
| 11 #include "core/frame/LocalFrame.h" | 11 #include "core/frame/LocalFrame.h" |
| 12 #include "core/workers/WorkletGlobalScopeProxy.h" | 12 #include "core/workers/WorkletGlobalScopeProxy.h" |
| 13 #include "core/workers/WorkletPendingTasks.h" | 13 #include "core/workers/WorkletPendingTasks.h" |
| 14 #include "platform/WebTaskRunner.h" | 14 #include "platform/WebTaskRunner.h" |
| 15 #include "platform/wtf/WTF.h" | 15 #include "platform/wtf/WTF.h" |
| 16 #include "public/platform/WebURLRequest.h" | |
| 17 | 16 |
| 18 namespace blink { | 17 namespace blink { |
| 19 | 18 |
| 20 namespace { | |
| 21 | |
| 22 WebURLRequest::FetchCredentialsMode ParseCredentialsOption( | |
| 23 const String& credentials_option) { | |
| 24 if (credentials_option == "omit") | |
| 25 return WebURLRequest::kFetchCredentialsModeOmit; | |
| 26 if (credentials_option == "same-origin") | |
| 27 return WebURLRequest::kFetchCredentialsModeSameOrigin; | |
| 28 if (credentials_option == "include") | |
| 29 return WebURLRequest::kFetchCredentialsModeInclude; | |
| 30 NOTREACHED(); | |
| 31 return WebURLRequest::kFetchCredentialsModeOmit; | |
| 32 } | |
| 33 | |
| 34 } // namespace | |
| 35 | |
| 36 MainThreadWorklet::MainThreadWorklet(LocalFrame* frame) : Worklet(frame) {} | 19 MainThreadWorklet::MainThreadWorklet(LocalFrame* frame) : Worklet(frame) {} |
| 37 | 20 |
| 38 WorkletGlobalScopeProxy* MainThreadWorklet::FindAvailableGlobalScope() const { | 21 WorkletGlobalScopeProxy* MainThreadWorklet::FindAvailableGlobalScope() const { |
| 39 DCHECK(IsMainThread()); | 22 DCHECK(IsMainThread()); |
| 40 // TODO(nhiroki): Support the case where there are multiple global scopes. | 23 // TODO(nhiroki): Support the case where there are multiple global scopes. |
| 41 DCHECK_EQ(1u, GetNumberOfGlobalScopes()); | 24 DCHECK_EQ(1u, GetNumberOfGlobalScopes()); |
| 42 return proxies_.begin()->get(); | 25 return proxies_.begin()->get(); |
| 43 } | 26 } |
| 44 | 27 |
| 45 // Implementation of the second half of the "addModule(moduleURL, options)" | 28 // Implementation of the second half of the "addModule(moduleURL, options)" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 DCHECK(IsMainThread()); | 87 DCHECK(IsMainThread()); |
| 105 for (const auto& proxy : proxies_) | 88 for (const auto& proxy : proxies_) |
| 106 proxy->TerminateWorkletGlobalScope(); | 89 proxy->TerminateWorkletGlobalScope(); |
| 107 } | 90 } |
| 108 | 91 |
| 109 DEFINE_TRACE(MainThreadWorklet) { | 92 DEFINE_TRACE(MainThreadWorklet) { |
| 110 Worklet::Trace(visitor); | 93 Worklet::Trace(visitor); |
| 111 } | 94 } |
| 112 | 95 |
| 113 } // namespace blink | 96 } // namespace blink |
| OLD | NEW |