| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "modules/worklet/WorkletGlobalScope.h" | 5 #include "modules/worklet/WorkletGlobalScope.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 7 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 // static | 11 // static |
| 12 PassRefPtrWillBeRawPtr<WorkletGlobalScope> WorkletGlobalScope::create(const KURL
& url, const String& userAgent, v8::Isolate* isolate) | 12 PassRefPtrWillBeRawPtr<WorkletGlobalScope> WorkletGlobalScope::create(const KURL
& url, const String& userAgent, PassRefPtr<SecurityOrigin> securityOrigin, v8::I
solate* isolate) |
| 13 { | 13 { |
| 14 RefPtrWillBeRawPtr<WorkletGlobalScope> workletGlobalScope = adoptRefWillBeNo
op(new WorkletGlobalScope(url, userAgent, isolate)); | 14 RefPtrWillBeRawPtr<WorkletGlobalScope> workletGlobalScope = adoptRefWillBeNo
op(new WorkletGlobalScope(url, userAgent, securityOrigin, isolate)); |
| 15 workletGlobalScope->script()->initializeContextIfNeeded(); | 15 workletGlobalScope->script()->initializeContextIfNeeded(); |
| 16 return workletGlobalScope.release(); | 16 return workletGlobalScope.release(); |
| 17 } | 17 } |
| 18 | 18 |
| 19 WorkletGlobalScope::WorkletGlobalScope(const KURL& url, const String& userAgent,
v8::Isolate* isolate) | 19 WorkletGlobalScope::WorkletGlobalScope(const KURL& url, const String& userAgent,
PassRefPtr<SecurityOrigin> securityOrigin, v8::Isolate* isolate) |
| 20 : m_script(WorkerOrWorkletScriptController::create(this, isolate)) | 20 : m_url(url) |
| 21 , m_userAgent(userAgent) |
| 22 , m_script(WorkerOrWorkletScriptController::create(this, isolate)) |
| 21 { | 23 { |
| 24 setSecurityOrigin(securityOrigin); |
| 22 } | 25 } |
| 23 | 26 |
| 24 WorkletGlobalScope::~WorkletGlobalScope() | 27 WorkletGlobalScope::~WorkletGlobalScope() |
| 25 { | 28 { |
| 26 } | 29 } |
| 27 | 30 |
| 28 v8::Local<v8::Object> WorkletGlobalScope::wrap(v8::Isolate*, v8::Local<v8::Objec
t> creationContext) | 31 v8::Local<v8::Object> WorkletGlobalScope::wrap(v8::Isolate*, v8::Local<v8::Objec
t> creationContext) |
| 29 { | 32 { |
| 30 // WorkletGlobalScope must never be wrapped with wrap method. The global | 33 // WorkletGlobalScope must never be wrapped with wrap method. The global |
| 31 // object of ECMAScript environment is used as the wrapper. | 34 // object of ECMAScript environment is used as the wrapper. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 67 } |
| 65 | 68 |
| 66 DEFINE_TRACE(WorkletGlobalScope) | 69 DEFINE_TRACE(WorkletGlobalScope) |
| 67 { | 70 { |
| 68 visitor->trace(m_script); | 71 visitor->trace(m_script); |
| 69 ExecutionContext::trace(visitor); | 72 ExecutionContext::trace(visitor); |
| 70 SecurityContext::trace(visitor); | 73 SecurityContext::trace(visitor); |
| 71 } | 74 } |
| 72 | 75 |
| 73 } // namespace blink | 76 } // namespace blink |
| OLD | NEW |