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