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

Side by Side Diff: Source/bindings/core/v8/ScheduledActionWithCallback.cpp

Issue 660863002: [DevTools] Added public method for async execution of scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: platform/WebExecuteScriptCallback -> web/WebScriptCallback Created 6 years, 2 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "bindings/core/v8/ScheduledActionWithCallback.h"
7
8 #include "bindings/core/v8/ScriptController.h"
9 #include "bindings/core/v8/ScriptSourceCode.h"
10 #include "bindings/core/v8/V8PersistentValueVector.h"
11 #include "core/frame/LocalFrame.h"
12 #include "platform/Logging.h"
13 #include "platform/TraceEvent.h"
14 #include "public/platform/WebVector.h"
15 #include "public/web/WebScriptCallback.h"
kozyatinskiy1 2014/10/17 08:44:21 For this line presubmit said: You added one or mor
16
17 namespace blink {
18
19 ScheduledActionWithCallback::ScheduledActionWithCallback(int worldID, const Vect or<ScriptSourceCode>& sources, int extensionGroup, WebScriptCallback* callback)
20 : m_worldID(worldID)
21 , m_sources(sources)
22 , m_extensionGroup(extensionGroup)
23 , m_callback(callback)
24 {
25 }
26
27 ScheduledActionWithCallback::~ScheduledActionWithCallback()
28 {
29 }
30
31 void ScheduledActionWithCallback::execute(LocalFrame* frame)
32 {
33 v8::HandleScope scope(v8::Isolate::GetCurrent());
34 Vector<v8::Local<v8::Value> > results;
35 WTF_LOG(Timers, "ScheduledAction::execute %p: executing from sources with ca llback", this);
36 if (m_worldID) {
37 frame->script().executeScriptInIsolatedWorld(m_worldID, m_sources, m_ext ensionGroup, &results);
38 } else {
39 v8::Local<v8::Value> scriptValue = frame->script().executeScriptInMainWo rldAndReturnValue(m_sources.first());
40 results.append(scriptValue);
41 }
42 m_callback->finished(results);
43
44 // The frame might be invalid at this point because JavaScript could have re leased it.
45 }
46
47 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698