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 | |
46 DEFINE_TRACE(ScriptSourceCode) { | 39 DEFINE_TRACE(ScriptSourceCode) { |
47 visitor->trace(m_resource); | 40 visitor->trace(m_resource); |
48 visitor->trace(m_streamer); | 41 visitor->trace(m_streamer); |
49 } | 42 } |
50 | 43 |
51 const KURL& ScriptSourceCode::url() const { | 44 const KURL& ScriptSourceCode::url() const { |
52 if (m_url.isEmpty() && m_resource) { | 45 if (m_url.isEmpty() && m_resource) { |
53 m_url = m_resource->response().url(); | 46 m_url = m_resource->response().url(); |
54 if (!m_url.isEmpty()) | 47 if (!m_url.isEmpty()) |
55 m_url.removeFragmentIdentifier(); | 48 m_url.removeFragmentIdentifier(); |
(...skipping 20 matching lines...) Expand all Loading... |
76 // | 69 // |
77 // Should the other constructors be passed a null string, that is interpreted | 70 // Should the other constructors be passed a null string, that is interpreted |
78 // as representing the empty script. Consequently, we need to disambiguate | 71 // as representing the empty script. Consequently, we need to disambiguate |
79 // between such null string occurrences. Do that by converting the latter | 72 // between such null string occurrences. Do that by converting the latter |
80 // case's null strings into empty ones. | 73 // case's null strings into empty ones. |
81 if (m_source.isNull()) | 74 if (m_source.isNull()) |
82 m_source = ""; | 75 m_source = ""; |
83 } | 76 } |
84 | 77 |
85 } // namespace blink | 78 } // namespace blink |
OLD | NEW |