| 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_resource(0) | 10 : m_resource(0) |
| 11 , m_startPosition(TextPosition::minimumPosition()) | 11 , m_startPosition(TextPosition::minimumPosition()) |
| 12 { | 12 { |
| 13 } | 13 } |
| 14 | 14 |
| 15 ScriptSourceCode::ScriptSourceCode(const String& source, const KURL& url, const
TextPosition& startPosition) | 15 ScriptSourceCode::ScriptSourceCode(const String& source, const KURL& url, const
TextPosition& startPosition) |
| 16 : ScriptSourceCode(CompressibleString(source.impl()), url, startPosition) |
| 17 { |
| 18 } |
| 19 |
| 20 ScriptSourceCode::ScriptSourceCode(const CompressibleString& source, const KURL&
url, const TextPosition& startPosition) |
| 16 : m_source(source) | 21 : m_source(source) |
| 17 , m_resource(0) | 22 , m_resource(0) |
| 18 , m_url(url) | 23 , m_url(url) |
| 19 , m_startPosition(startPosition) | 24 , m_startPosition(startPosition) |
| 20 { | 25 { |
| 21 treatNullSourceAsEmpty(); | 26 treatNullSourceAsEmpty(); |
| 22 if (!m_url.isEmpty()) | 27 if (!m_url.isEmpty()) |
| 23 m_url.removeFragmentIdentifier(); | 28 m_url.removeFragmentIdentifier(); |
| 24 } | 29 } |
| 25 | 30 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void ScriptSourceCode::treatNullSourceAsEmpty() | 80 void ScriptSourceCode::treatNullSourceAsEmpty() |
| 76 { | 81 { |
| 77 // ScriptSourceCode allows for the representation of the null/not-there-real
ly ScriptSourceCode value. | 82 // ScriptSourceCode allows for the representation of the null/not-there-real
ly ScriptSourceCode value. |
| 78 // Encoded by way of a m_source.isNull() being true, with the nullary constr
uctor to be used to | 83 // Encoded by way of a m_source.isNull() being true, with the nullary constr
uctor to be used to |
| 79 // construct such a value. | 84 // construct such a value. |
| 80 // | 85 // |
| 81 // Should the other constructors be passed a null string, that is interprete
d as representing | 86 // Should the other constructors be passed a null string, that is interprete
d as representing |
| 82 // the empty script. Consequently, we need to disambiguate between such null
string occurrences. | 87 // the empty script. Consequently, we need to disambiguate between such null
string occurrences. |
| 83 // Do that by converting the latter case's null strings into empty ones. | 88 // Do that by converting the latter case's null strings into empty ones. |
| 84 if (m_source.isNull()) | 89 if (m_source.isNull()) |
| 85 m_source = ""; | 90 m_source = CompressibleString(); |
| 86 } | 91 } |
| 87 | 92 |
| 88 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |