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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScheduledAction.cpp

Issue 1728803002: Rename WorkerThread to WorkerScript Base URL: https://chromium.googlesource.com/chromium/src.git@workerscript-controller
Patch Set: Created 4 years, 9 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) 2007-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 32
33 #include "bindings/core/v8/ScriptController.h" 33 #include "bindings/core/v8/ScriptController.h"
34 #include "bindings/core/v8/ScriptSourceCode.h" 34 #include "bindings/core/v8/ScriptSourceCode.h"
35 #include "bindings/core/v8/V8Binding.h" 35 #include "bindings/core/v8/V8Binding.h"
36 #include "bindings/core/v8/V8GCController.h" 36 #include "bindings/core/v8/V8GCController.h"
37 #include "bindings/core/v8/V8ScriptRunner.h" 37 #include "bindings/core/v8/V8ScriptRunner.h"
38 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
39 #include "core/dom/ExecutionContext.h" 39 #include "core/dom/ExecutionContext.h"
40 #include "core/frame/LocalFrame.h" 40 #include "core/frame/LocalFrame.h"
41 #include "core/workers/WorkerGlobalScope.h" 41 #include "core/workers/WorkerGlobalScope.h"
42 #include "core/workers/WorkerThread.h" 42 #include "core/workers/WorkerScript.h"
43 #include "platform/Logging.h" 43 #include "platform/Logging.h"
44 #include "platform/TraceEvent.h" 44 #include "platform/TraceEvent.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 PassOwnPtrWillBeRawPtr<ScheduledAction> ScheduledAction::create(ScriptState* scr iptState, const ScriptValue& handler, const Vector<ScriptValue>& arguments) 48 PassOwnPtrWillBeRawPtr<ScheduledAction> ScheduledAction::create(ScriptState* scr iptState, const ScriptValue& handler, const Vector<ScriptValue>& arguments)
49 { 49 {
50 ASSERT(handler.isFunction()); 50 ASSERT(handler.isFunction());
51 return adoptPtrWillBeNoop(new ScheduledAction(scriptState, handler, argument s)); 51 return adoptPtrWillBeNoop(new ScheduledAction(scriptState, handler, argument s));
52 } 52 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } else { 120 } else {
121 WTF_LOG(Timers, "ScheduledAction::execute %p: executing from source", th is); 121 WTF_LOG(Timers, "ScheduledAction::execute %p: executing from source", th is);
122 frame->script().executeScriptAndReturnValue(m_scriptState->context(), Sc riptSourceCode(m_code)); 122 frame->script().executeScriptAndReturnValue(m_scriptState->context(), Sc riptSourceCode(m_code));
123 } 123 }
124 124
125 // The frame might be invalid at this point because JavaScript could have re leased it. 125 // The frame might be invalid at this point because JavaScript could have re leased it.
126 } 126 }
127 127
128 void ScheduledAction::execute(WorkerGlobalScope* worker) 128 void ScheduledAction::execute(WorkerGlobalScope* worker)
129 { 129 {
130 ASSERT(worker->thread()->isCurrentThread()); 130 ASSERT(worker->workerScript()->isCurrentThread());
131 ASSERT(m_scriptState->contextIsValid()); 131 ASSERT(m_scriptState->contextIsValid());
132 if (!m_function.isEmpty()) { 132 if (!m_function.isEmpty()) {
133 ScriptState::Scope scope(m_scriptState.get()); 133 ScriptState::Scope scope(m_scriptState.get());
134 Vector<v8::Local<v8::Value>> info; 134 Vector<v8::Local<v8::Value>> info;
135 createLocalHandlesForArgs(&info); 135 createLocalHandlesForArgs(&info);
136 V8ScriptRunner::callFunction(m_function.newLocal(m_scriptState->isolate( )), worker, m_scriptState->context()->Global(), info.size(), info.data(), m_scri ptState->isolate()); 136 V8ScriptRunner::callFunction(m_function.newLocal(m_scriptState->isolate( )), worker, m_scriptState->context()->Global(), info.size(), info.data(), m_scri ptState->isolate());
137 } else { 137 } else {
138 worker->scriptController()->evaluate(m_code); 138 worker->scriptController()->evaluate(m_code);
139 } 139 }
140 } 140 }
141 141
142 void ScheduledAction::createLocalHandlesForArgs(Vector<v8::Local<v8::Value>>* ha ndles) 142 void ScheduledAction::createLocalHandlesForArgs(Vector<v8::Local<v8::Value>>* ha ndles)
143 { 143 {
144 handles->reserveCapacity(m_info.Size()); 144 handles->reserveCapacity(m_info.Size());
145 for (size_t i = 0; i < m_info.Size(); ++i) 145 for (size_t i = 0; i < m_info.Size(); ++i)
146 handles->append(m_info.Get(i)); 146 handles->append(m_info.Get(i));
147 } 147 }
148 148
149 } // namespace blink 149 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698