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

Side by Side Diff: third_party/WebKit/Source/modules/worklet/WorkletGlobalScope.cpp

Issue 1726903002: Rename WorkerOrWorkletGlobalScope::script() to scriptController() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 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 // 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, PassRefPtr<SecurityOrigin> securityOrigin, v8::I solate* 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, securityOrigin, isolate)); 14 RefPtrWillBeRawPtr<WorkletGlobalScope> workletGlobalScope = adoptRefWillBeNo op(new WorkletGlobalScope(url, userAgent, securityOrigin, isolate));
15 workletGlobalScope->script()->initializeContextIfNeeded(); 15 workletGlobalScope->scriptController()->initializeContextIfNeeded();
16 return workletGlobalScope.release(); 16 return workletGlobalScope.release();
17 } 17 }
18 18
19 WorkletGlobalScope::WorkletGlobalScope(const KURL& url, const String& userAgent, PassRefPtr<SecurityOrigin> securityOrigin, v8::Isolate* isolate) 19 WorkletGlobalScope::WorkletGlobalScope(const KURL& url, const String& userAgent, PassRefPtr<SecurityOrigin> securityOrigin, v8::Isolate* isolate)
20 : m_url(url) 20 : m_url(url)
21 , m_userAgent(userAgent) 21 , m_userAgent(userAgent)
22 , m_script(WorkerOrWorkletScriptController::create(this, isolate)) 22 , m_scriptController(WorkerOrWorkletScriptController::create(this, isolate))
23 { 23 {
24 setSecurityOrigin(securityOrigin); 24 setSecurityOrigin(securityOrigin);
25 } 25 }
26 26
27 WorkletGlobalScope::~WorkletGlobalScope() 27 WorkletGlobalScope::~WorkletGlobalScope()
28 { 28 {
29 } 29 }
30 30
31 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)
32 { 32 {
33 // WorkletGlobalScope must never be wrapped with wrap method. The global 33 // WorkletGlobalScope must never be wrapped with wrap method. The global
34 // object of ECMAScript environment is used as the wrapper. 34 // object of ECMAScript environment is used as the wrapper.
35 RELEASE_ASSERT_NOT_REACHED(); 35 RELEASE_ASSERT_NOT_REACHED();
36 return v8::Local<v8::Object>(); 36 return v8::Local<v8::Object>();
37 } 37 }
38 38
39 v8::Local<v8::Object> WorkletGlobalScope::associateWithWrapper(v8::Isolate*, con st WrapperTypeInfo*, v8::Local<v8::Object> wrapper) 39 v8::Local<v8::Object> WorkletGlobalScope::associateWithWrapper(v8::Isolate*, con st WrapperTypeInfo*, v8::Local<v8::Object> wrapper)
40 { 40 {
41 RELEASE_ASSERT_NOT_REACHED(); // Same as wrap method. 41 RELEASE_ASSERT_NOT_REACHED(); // Same as wrap method.
42 return v8::Local<v8::Object>(); 42 return v8::Local<v8::Object>();
43 } 43 }
44 44
45 void WorkletGlobalScope::disableEval(const String& errorMessage) 45 void WorkletGlobalScope::disableEval(const String& errorMessage)
46 { 46 {
47 m_script->disableEval(errorMessage); 47 m_scriptController->disableEval(errorMessage);
48 } 48 }
49 49
50 bool WorkletGlobalScope::isSecureContext(String& errorMessage, const SecureConte xtCheck privilegeContextCheck) const 50 bool WorkletGlobalScope::isSecureContext(String& errorMessage, const SecureConte xtCheck privilegeContextCheck) const
51 { 51 {
52 // Until there are APIs that are available in worklets and that 52 // Until there are APIs that are available in worklets and that
53 // require a privileged context test that checks ancestors, just do 53 // require a privileged context test that checks ancestors, just do
54 // a simple check here. 54 // a simple check here.
55 if (securityOrigin()->isPotentiallyTrustworthy()) 55 if (securityOrigin()->isPotentiallyTrustworthy())
56 return true; 56 return true;
57 errorMessage = securityOrigin()->isPotentiallyTrustworthyErrorMessage(); 57 errorMessage = securityOrigin()->isPotentiallyTrustworthyErrorMessage();
58 return false; 58 return false;
59 } 59 }
60 60
61 KURL WorkletGlobalScope::virtualCompleteURL(const String& url) const 61 KURL WorkletGlobalScope::virtualCompleteURL(const String& url) const
62 { 62 {
63 // Always return a null URL when passed a null string. 63 // Always return a null URL when passed a null string.
64 // TODO(ikilpatrick): Should we change the KURL constructor to have this 64 // TODO(ikilpatrick): Should we change the KURL constructor to have this
65 // behavior? 65 // behavior?
66 if (url.isNull()) 66 if (url.isNull())
67 return KURL(); 67 return KURL();
68 // Always use UTF-8 in Worklets. 68 // Always use UTF-8 in Worklets.
69 return KURL(m_url, url); 69 return KURL(m_url, url);
70 } 70 }
71 71
72 DEFINE_TRACE(WorkletGlobalScope) 72 DEFINE_TRACE(WorkletGlobalScope)
73 { 73 {
74 visitor->trace(m_script); 74 visitor->trace(m_scriptController);
75 ExecutionContext::trace(visitor); 75 ExecutionContext::trace(visitor);
76 SecurityContext::trace(visitor); 76 SecurityContext::trace(visitor);
77 } 77 }
78 78
79 } // namespace blink 79 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698