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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 class CORE_EXPORT ScriptSourceCode final { | 44 class CORE_EXPORT ScriptSourceCode final { |
45 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 45 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
46 public: | 46 public: |
47 ScriptSourceCode(); | 47 ScriptSourceCode(); |
48 // We lose the encoding information from ScriptResource. | 48 // We lose the encoding information from ScriptResource. |
49 // Not sure if that matters. | 49 // Not sure if that matters. |
50 explicit ScriptSourceCode(ScriptResource*); | 50 explicit ScriptSourceCode(ScriptResource*); |
51 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()); |
52 ScriptSourceCode(const CompressibleString&, const KURL& = KURL(), const Text
Position& startPosition = TextPosition::minimumPosition()); | |
53 ScriptSourceCode(ScriptStreamer*, ScriptResource*); | 52 ScriptSourceCode(ScriptStreamer*, ScriptResource*); |
54 | 53 |
55 ~ScriptSourceCode(); | 54 ~ScriptSourceCode(); |
56 DECLARE_TRACE(); | 55 DECLARE_TRACE(); |
57 | 56 |
58 bool isEmpty() const { return m_source.isEmpty(); } | 57 bool isEmpty() const { return m_source.isEmpty(); } |
59 | 58 |
60 // The null value represents a missing script, created by the nullary | 59 // The null value represents a missing script, created by the nullary |
61 // constructor, and differs from the empty script. | 60 // constructor, and differs from the empty script. |
62 bool isNull() const { return m_source.isNull(); } | 61 bool isNull() const { return m_source.isNull(); } |
63 | 62 |
64 const CompressibleString& source() const { return m_source; } | 63 const String& source() const { return m_source; } |
65 ScriptResource* resource() const { return m_resource.get(); } | 64 ScriptResource* resource() const { return m_resource.get(); } |
66 const KURL& url() const; | 65 const KURL& url() const; |
67 int startLine() const { return m_startPosition.m_line.oneBasedInt(); } | 66 int startLine() const { return m_startPosition.m_line.oneBasedInt(); } |
68 const TextPosition& startPosition() const { return m_startPosition; } | 67 const TextPosition& startPosition() const { return m_startPosition; } |
69 String sourceMapUrl() const; | 68 String sourceMapUrl() const; |
70 | 69 |
71 ScriptStreamer* streamer() const { return m_streamer.get(); } | 70 ScriptStreamer* streamer() const { return m_streamer.get(); } |
72 | 71 |
73 private: | 72 private: |
74 void treatNullSourceAsEmpty(); | 73 void treatNullSourceAsEmpty(); |
75 | 74 |
76 CompressibleString m_source; | 75 String m_source; |
77 Member<ScriptResource> m_resource; | 76 Member<ScriptResource> m_resource; |
78 Member<ScriptStreamer> m_streamer; | 77 Member<ScriptStreamer> m_streamer; |
79 mutable KURL m_url; | 78 mutable KURL m_url; |
80 TextPosition m_startPosition; | 79 TextPosition m_startPosition; |
81 }; | 80 }; |
82 | 81 |
83 } // namespace blink | 82 } // namespace blink |
84 | 83 |
85 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::ScriptSourceCode); | 84 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::ScriptSourceCode); |
86 | 85 |
87 #endif // ScriptSourceCode_h | 86 #endif // ScriptSourceCode_h |
OLD | NEW |