Chromium Code Reviews| 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 "config.h" | 6 #include "config.h" |
| 7 #include "bindings/core/v8/ScriptStreamer.h" | 7 #include "bindings/core/v8/ScriptStreamer.h" |
| 8 | 8 |
| 9 #include "bindings/core/v8/ScriptSourceCode.h" | 9 #include "bindings/core/v8/ScriptSourceCode.h" |
| 10 #include "bindings/core/v8/ScriptStreamerThread.h" | 10 #include "bindings/core/v8/ScriptStreamerThread.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 // The bool param for ScriptStreamingTest controls whether to make the main | 62 // The bool param for ScriptStreamingTest controls whether to make the main |
| 63 // thread block and wait for parsing. | 63 // thread block and wait for parsing. |
| 64 class ScriptStreamingTest : public testing::TestWithParam<bool> { | 64 class ScriptStreamingTest : public testing::TestWithParam<bool> { |
| 65 public: | 65 public: |
| 66 ScriptStreamingTest() | 66 ScriptStreamingTest() |
| 67 : m_scope(v8::Isolate::GetCurrent()) | 67 : m_scope(v8::Isolate::GetCurrent()) |
| 68 , m_settings(Settings::create()) | 68 , m_settings(Settings::create()) |
| 69 , m_resourceRequest("http://www.streaming-test.com/") | 69 , m_resourceRequest("http://www.streaming-test.com/") |
| 70 , m_resource(new ScriptResource(m_resourceRequest, "UTF-8")) | 70 , m_resource(ScriptResource::create(m_resourceRequest, "UTF-8").leakPtr( )) |
|
haraken
2015/01/08 01:17:21
Who deletes the leaked m_resource?
sof
2015/01/08 06:17:14
See comment on the next line.
haraken
2015/01/08 06:18:00
ah, ok.
| |
| 71 , m_pendingScript(PendingScriptWrapper::create(0, m_resource)) // Takes ownership of m_resource. | 71 , m_pendingScript(PendingScriptWrapper::create(0, m_resource)) // Takes ownership of m_resource. |
| 72 { | 72 { |
| 73 m_settings->setV8ScriptStreamingEnabled(true); | 73 m_settings->setV8ScriptStreamingEnabled(true); |
| 74 if (GetParam()) | 74 if (GetParam()) |
| 75 m_settings->setV8ScriptStreamingMode(ScriptStreamingModeAllPlusBlock ParsingBlocking); | 75 m_settings->setV8ScriptStreamingMode(ScriptStreamingModeAllPlusBlock ParsingBlocking); |
| 76 m_resource->setLoading(true); | 76 m_resource->setLoading(true); |
| 77 ScriptStreamer::setSmallScriptThresholdForTesting(0); | 77 ScriptStreamer::setSmallScriptThresholdForTesting(0); |
| 78 } | 78 } |
| 79 | 79 |
| 80 ScriptState* scriptState() const { return m_scope.scriptState(); } | 80 ScriptState* scriptState() const { return m_scope.scriptState(); } |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(sourceCode, is olate()); | 390 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(sourceCode, is olate()); |
| 391 EXPECT_FALSE(script.IsEmpty()); | 391 EXPECT_FALSE(script.IsEmpty()); |
| 392 EXPECT_FALSE(tryCatch.HasCaught()); | 392 EXPECT_FALSE(tryCatch.HasCaught()); |
| 393 } | 393 } |
| 394 | 394 |
| 395 INSTANTIATE_TEST_CASE_P(ScriptStreamingInstantiation, ScriptStreamingTest, ::tes ting::Values(false, true)); | 395 INSTANTIATE_TEST_CASE_P(ScriptStreamingInstantiation, ScriptStreamingTest, ::tes ting::Values(false, true)); |
| 396 | 396 |
| 397 } // namespace | 397 } // namespace |
| 398 | 398 |
| 399 } // namespace blink | 399 } // namespace blink |
| OLD | NEW |