OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "bindings/core/v8/ScriptSourceCode.h" |
| 7 |
| 8 namespace blink { |
| 9 |
| 10 ScriptSourceCode::ScriptSourceCode() |
| 11 : m_resource(0) |
| 12 , m_startPosition(TextPosition::minimumPosition()) |
| 13 { |
| 14 } |
| 15 |
| 16 ScriptSourceCode::ScriptSourceCode(const String& source, const KURL& url, const
TextPosition& startPosition) |
| 17 : m_source(source) |
| 18 , m_resource(0) |
| 19 , m_url(url) |
| 20 , m_startPosition(startPosition) |
| 21 { |
| 22 if (!m_url.isEmpty()) |
| 23 m_url.removeFragmentIdentifier(); |
| 24 } |
| 25 |
| 26 ScriptSourceCode::ScriptSourceCode(ScriptResource* resource) |
| 27 : m_source(resource->script()) |
| 28 , m_resource(resource) |
| 29 , m_startPosition(TextPosition::minimumPosition()) |
| 30 { |
| 31 } |
| 32 |
| 33 ScriptSourceCode::ScriptSourceCode(PassRefPtrWillBeRawPtr<ScriptStreamer> stream
er, ScriptResource* resource) |
| 34 : m_source(resource->script()) |
| 35 , m_resource(resource) |
| 36 , m_streamer(streamer) |
| 37 , m_startPosition(TextPosition::minimumPosition()) |
| 38 { |
| 39 } |
| 40 |
| 41 ScriptSourceCode::~ScriptSourceCode() |
| 42 { |
| 43 } |
| 44 |
| 45 void ScriptSourceCode::trace(Visitor* visitor) |
| 46 { |
| 47 visitor->trace(m_streamer); |
| 48 } |
| 49 |
| 50 const KURL& ScriptSourceCode::url() const |
| 51 { |
| 52 if (m_url.isEmpty() && m_resource) { |
| 53 m_url = m_resource->response().url(); |
| 54 if (!m_url.isEmpty()) |
| 55 m_url.removeFragmentIdentifier(); |
| 56 } |
| 57 return m_url; |
| 58 } |
| 59 |
| 60 } // namespace blink |
OLD | NEW |