Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptSourceCode.h

Issue 2724673002: [WIP] Introduce ScriptResourceData
Patch Set: Compile fix Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/loader/resource/ScriptResource.h" 36 #include "core/loader/resource/ScriptResourceData.h"
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 #include "platform/weborigin/KURL.h" 38 #include "platform/weborigin/KURL.h"
39 #include "platform/wtf/text/TextPosition.h" 39 #include "platform/wtf/text/TextPosition.h"
40 #include "platform/wtf/text/WTFString.h" 40 #include "platform/wtf/text/WTFString.h"
41 41
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 46
47 public: 47 public:
48 ScriptSourceCode(); 48 ScriptSourceCode();
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(const ScriptResourceData*);
52 ScriptSourceCode( 52 ScriptSourceCode(
53 const String&, 53 const String&,
54 const KURL& = KURL(), 54 const KURL& = KURL(),
55 const TextPosition& start_position = TextPosition::MinimumPosition()); 55 const TextPosition& start_position = TextPosition::MinimumPosition());
56 ScriptSourceCode(ScriptStreamer*, ScriptResource*); 56 ScriptSourceCode(ScriptStreamer*, const ScriptResourceData*);
57 57
58 ~ScriptSourceCode(); 58 ~ScriptSourceCode();
59 DECLARE_TRACE(); 59 DECLARE_TRACE();
60 60
61 // The null value represents a missing script, created by the nullary 61 // The null value represents a missing script, created by the nullary
62 // constructor, and differs from the empty script. 62 // constructor, and differs from the empty script.
63 bool IsNull() const { return source_.IsNull(); } 63 bool IsNull() const { return source_.IsNull(); }
64 64
65 const String& Source() const { return source_; } 65 const String& Source() const { return source_; }
66 ScriptResource* GetResource() const { return resource_; } 66 const ScriptResourceData* GetResource() const { return resource_; }
67 const KURL& Url() const; 67 const KURL& Url() const;
68 int StartLine() const { return start_position_.line_.OneBasedInt(); } 68 int StartLine() const { return start_position_.line_.OneBasedInt(); }
69 const TextPosition& StartPosition() const { return start_position_; } 69 const TextPosition& StartPosition() const { return start_position_; }
70 String SourceMapUrl() const; 70 String SourceMapUrl() const;
71 71
72 ScriptStreamer* Streamer() const { return streamer_; } 72 ScriptStreamer* Streamer() const { return streamer_; }
73 73
74 private: 74 private:
75 void TreatNullSourceAsEmpty(); 75 void TreatNullSourceAsEmpty();
76 76
77 String source_; 77 String source_;
78 Member<ScriptResource> resource_; 78 Member<const ScriptResourceData> resource_;
79 Member<ScriptStreamer> streamer_; 79 Member<ScriptStreamer> streamer_;
80 mutable KURL url_; 80 mutable KURL url_;
81 TextPosition start_position_; 81 TextPosition start_position_;
82 }; 82 };
83 83
84 } // namespace blink 84 } // namespace blink
85 85
86 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::ScriptSourceCode); 86 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::ScriptSourceCode);
87 87
88 #endif // ScriptSourceCode_h 88 #endif // ScriptSourceCode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698