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