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

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

Issue 2023683002: Tidy PendingScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove prefinalizer Created 4 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/PendingScript.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 5
6 #include "bindings/core/v8/ScriptStreamer.h" 6 #include "bindings/core/v8/ScriptStreamer.h"
7 7
8 #include "bindings/core/v8/ScriptSourceCode.h" 8 #include "bindings/core/v8/ScriptSourceCode.h"
9 #include "bindings/core/v8/ScriptStreamerThread.h" 9 #include "bindings/core/v8/ScriptStreamerThread.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
(...skipping 21 matching lines...) Expand all
32 , m_settings(Settings::create()) 32 , m_settings(Settings::create())
33 , m_resourceRequest("http://www.streaming-test.com/") 33 , m_resourceRequest("http://www.streaming-test.com/")
34 , m_resource(ScriptResource::create(m_resourceRequest, "UTF-8")) 34 , m_resource(ScriptResource::create(m_resourceRequest, "UTF-8"))
35 , m_pendingScript(PendingScript::create(0, m_resource.get())) 35 , m_pendingScript(PendingScript::create(0, m_resource.get()))
36 { 36 {
37 m_resource->setStatus(Resource::Pending); 37 m_resource->setStatus(Resource::Pending);
38 m_pendingScript = PendingScript::create(0, m_resource.get()); 38 m_pendingScript = PendingScript::create(0, m_resource.get());
39 ScriptStreamer::setSmallScriptThresholdForTesting(0); 39 ScriptStreamer::setSmallScriptThresholdForTesting(0);
40 } 40 }
41 41
42 ~ScriptStreamingTest()
43 {
44 if (m_pendingScript)
45 m_pendingScript->dispose();
46 }
47
42 ScriptState* getScriptState() const { return m_scope.getScriptState(); } 48 ScriptState* getScriptState() const { return m_scope.getScriptState(); }
43 v8::Isolate* isolate() const { return m_scope.isolate(); } 49 v8::Isolate* isolate() const { return m_scope.isolate(); }
44 50
45 PendingScript* getPendingScript() const { return m_pendingScript.get(); } 51 PendingScript* getPendingScript() const { return m_pendingScript.get(); }
46 52
47 protected: 53 protected:
48 void appendData(const char* data) 54 void appendData(const char* data)
49 { 55 {
50 m_resource->appendData(data, strlen(data)); 56 m_resource->appendData(data, strlen(data));
51 // Yield control to the background thread, so that V8 gets a chance to 57 // Yield control to the background thread, so that V8 gets a chance to
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 EXPECT_TRUE(sourceCode.streamer()); 381 EXPECT_TRUE(sourceCode.streamer());
376 v8::TryCatch tryCatch(isolate()); 382 v8::TryCatch tryCatch(isolate());
377 v8::Local<v8::Script> script; 383 v8::Local<v8::Script> script;
378 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc ript)); 384 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, isolate()).ToLocal(&sc ript));
379 EXPECT_FALSE(tryCatch.HasCaught()); 385 EXPECT_FALSE(tryCatch.HasCaught());
380 } 386 }
381 387
382 } // namespace 388 } // namespace
383 389
384 } // namespace blink 390 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/PendingScript.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698