OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef ScriptSourceCode_h | 31 #ifndef ScriptSourceCode_h |
32 #define ScriptSourceCode_h | 32 #define ScriptSourceCode_h |
33 | 33 |
34 #include "bindings/core/v8/ScriptStreamer.h" | 34 #include "bindings/core/v8/ScriptStreamer.h" |
35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
36 #include "core/fetch/ResourcePtr.h" | |
37 #include "core/fetch/ScriptResource.h" | 36 #include "core/fetch/ScriptResource.h" |
38 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
39 #include "platform/weborigin/KURL.h" | 38 #include "platform/weborigin/KURL.h" |
40 #include "wtf/text/TextPosition.h" | 39 #include "wtf/text/TextPosition.h" |
41 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
42 | 41 |
43 namespace blink { | 42 namespace blink { |
44 | 43 |
45 template <class R> class ResourcePtr; | |
46 class ScriptResource; | |
47 | |
48 class CORE_EXPORT ScriptSourceCode final { | 44 class CORE_EXPORT ScriptSourceCode final { |
49 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 45 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
50 public: | 46 public: |
51 ScriptSourceCode(); | 47 ScriptSourceCode(); |
52 // We lose the encoding information from ScriptResource. | 48 // We lose the encoding information from ScriptResource. |
53 // Not sure if that matters. | 49 // Not sure if that matters. |
54 explicit ScriptSourceCode(ScriptResource*); | 50 explicit ScriptSourceCode(ScriptResource*); |
55 ScriptSourceCode(const String&, const KURL& = KURL(), const TextPosition& st
artPosition = TextPosition::minimumPosition()); | 51 ScriptSourceCode(const String&, const KURL& = KURL(), const TextPosition& st
artPosition = TextPosition::minimumPosition()); |
56 ScriptSourceCode(const CompressibleString&, const KURL& = KURL(), const Text
Position& startPosition = TextPosition::minimumPosition()); | 52 ScriptSourceCode(const CompressibleString&, const KURL& = KURL(), const Text
Position& startPosition = TextPosition::minimumPosition()); |
57 ScriptSourceCode(PassRefPtrWillBeRawPtr<ScriptStreamer>, ScriptResource*); | 53 ScriptSourceCode(PassRefPtrWillBeRawPtr<ScriptStreamer>, ScriptResource*); |
(...skipping 13 matching lines...) Expand all Loading... |
71 int startLine() const { return m_startPosition.m_line.oneBasedInt(); } | 67 int startLine() const { return m_startPosition.m_line.oneBasedInt(); } |
72 const TextPosition& startPosition() const { return m_startPosition; } | 68 const TextPosition& startPosition() const { return m_startPosition; } |
73 String sourceMapUrl() const; | 69 String sourceMapUrl() const; |
74 | 70 |
75 ScriptStreamer* streamer() const { return m_streamer.get(); } | 71 ScriptStreamer* streamer() const { return m_streamer.get(); } |
76 | 72 |
77 private: | 73 private: |
78 void treatNullSourceAsEmpty(); | 74 void treatNullSourceAsEmpty(); |
79 | 75 |
80 CompressibleString m_source; | 76 CompressibleString m_source; |
81 ResourcePtr<ScriptResource> m_resource; | 77 RefPtrWillBeMember<ScriptResource> m_resource; |
82 RefPtrWillBeMember<ScriptStreamer> m_streamer; | 78 RefPtrWillBeMember<ScriptStreamer> m_streamer; |
83 mutable KURL m_url; | 79 mutable KURL m_url; |
84 TextPosition m_startPosition; | 80 TextPosition m_startPosition; |
85 }; | 81 }; |
86 | 82 |
87 } // namespace blink | 83 } // namespace blink |
88 | 84 |
89 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::ScriptSourceCode); | 85 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::ScriptSourceCode); |
90 | 86 |
91 #endif // ScriptSourceCode_h | 87 #endif // ScriptSourceCode_h |
OLD | NEW |