| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |