| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "bindings/core/v8/ScriptSourceCode.h" | 5 #include "bindings/core/v8/ScriptSourceCode.h" |
| 6 | 6 |
| 7 namespace blink { | 7 namespace blink { |
| 8 | 8 |
| 9 ScriptSourceCode::ScriptSourceCode() | 9 ScriptSourceCode::ScriptSourceCode() |
| 10 : m_startPosition(TextPosition::minimumPosition()) {} | 10 : m_startPosition(TextPosition::minimumPosition()) {} |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 ScriptResource* resource) | 29 ScriptResource* resource) |
| 30 : m_source(resource->script()), | 30 : m_source(resource->script()), |
| 31 m_resource(resource), | 31 m_resource(resource), |
| 32 m_streamer(streamer), | 32 m_streamer(streamer), |
| 33 m_startPosition(TextPosition::minimumPosition()) { | 33 m_startPosition(TextPosition::minimumPosition()) { |
| 34 treatNullSourceAsEmpty(); | 34 treatNullSourceAsEmpty(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 ScriptSourceCode::~ScriptSourceCode() {} | 37 ScriptSourceCode::~ScriptSourceCode() {} |
| 38 | 38 |
| 39 void ScriptSourceCode::dispose() { |
| 40 m_source = String(); |
| 41 m_resource = nullptr; |
| 42 m_streamer = nullptr; |
| 43 m_url = KURL(); |
| 44 } |
| 45 |
| 39 DEFINE_TRACE(ScriptSourceCode) { | 46 DEFINE_TRACE(ScriptSourceCode) { |
| 40 visitor->trace(m_resource); | 47 visitor->trace(m_resource); |
| 41 visitor->trace(m_streamer); | 48 visitor->trace(m_streamer); |
| 42 } | 49 } |
| 43 | 50 |
| 44 const KURL& ScriptSourceCode::url() const { | 51 const KURL& ScriptSourceCode::url() const { |
| 45 if (m_url.isEmpty() && m_resource) { | 52 if (m_url.isEmpty() && m_resource) { |
| 46 m_url = m_resource->response().url(); | 53 m_url = m_resource->response().url(); |
| 47 if (!m_url.isEmpty()) | 54 if (!m_url.isEmpty()) |
| 48 m_url.removeFragmentIdentifier(); | 55 m_url.removeFragmentIdentifier(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 69 // | 76 // |
| 70 // Should the other constructors be passed a null string, that is interpreted | 77 // Should the other constructors be passed a null string, that is interpreted |
| 71 // as representing the empty script. Consequently, we need to disambiguate | 78 // as representing the empty script. Consequently, we need to disambiguate |
| 72 // between such null string occurrences. Do that by converting the latter | 79 // between such null string occurrences. Do that by converting the latter |
| 73 // case's null strings into empty ones. | 80 // case's null strings into empty ones. |
| 74 if (m_source.isNull()) | 81 if (m_source.isNull()) |
| 75 m_source = ""; | 82 m_source = ""; |
| 76 } | 83 } |
| 77 | 84 |
| 78 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |