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

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

Issue 2724673002: [WIP] Introduce ScriptResourceData
Patch Set: Fix Created 3 years, 7 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptSourceCode.h" 5 #include "bindings/core/v8/ScriptSourceCode.h"
6 6
7 #include "platform/HTTPNames.h"
8
7 namespace blink { 9 namespace blink {
8 10
9 ScriptSourceCode::ScriptSourceCode() 11 ScriptSourceCode::ScriptSourceCode()
10 : start_position_(TextPosition::MinimumPosition()) {} 12 : start_position_(TextPosition::MinimumPosition()) {}
11 13
12 ScriptSourceCode::ScriptSourceCode(const String& source, 14 ScriptSourceCode::ScriptSourceCode(const String& source,
13 const KURL& url, 15 const KURL& url,
14 const TextPosition& start_position) 16 const TextPosition& start_position)
15 : source_(source), url_(url), start_position_(start_position) { 17 : source_(source), url_(url), start_position_(start_position) {
16 TreatNullSourceAsEmpty(); 18 TreatNullSourceAsEmpty();
17 if (!url_.IsEmpty()) 19 if (!url_.IsEmpty())
18 url_.RemoveFragmentIdentifier(); 20 url_.RemoveFragmentIdentifier();
19 } 21 }
20 22
21 ScriptSourceCode::ScriptSourceCode(ScriptResource* resource) 23 ScriptSourceCode::ScriptSourceCode(const ScriptResourceData* resource)
22 : source_(resource->SourceText()), 24 : source_(resource->SourceText()),
23 resource_(resource), 25 resource_(resource),
24 start_position_(TextPosition::MinimumPosition()) { 26 start_position_(TextPosition::MinimumPosition()) {
25 TreatNullSourceAsEmpty(); 27 TreatNullSourceAsEmpty();
26 } 28 }
27 29
28 ScriptSourceCode::ScriptSourceCode(ScriptStreamer* streamer, 30 ScriptSourceCode::ScriptSourceCode(ScriptStreamer* streamer,
29 ScriptResource* resource) 31 const ScriptResourceData* resource)
30 : source_(resource->SourceText()), 32 : source_(resource->SourceText()),
31 resource_(resource), 33 resource_(resource),
32 streamer_(streamer), 34 streamer_(streamer),
33 start_position_(TextPosition::MinimumPosition()) { 35 start_position_(TextPosition::MinimumPosition()) {
34 TreatNullSourceAsEmpty(); 36 TreatNullSourceAsEmpty();
35 } 37 }
36 38
37 ScriptSourceCode::~ScriptSourceCode() {} 39 ScriptSourceCode::~ScriptSourceCode() {}
38 40
39 DEFINE_TRACE(ScriptSourceCode) { 41 DEFINE_TRACE(ScriptSourceCode) {
(...skipping 29 matching lines...) Expand all
69 // 71 //
70 // Should the other constructors be passed a null string, that is interpreted 72 // Should the other constructors be passed a null string, that is interpreted
71 // as representing the empty script. Consequently, we need to disambiguate 73 // as representing the empty script. Consequently, we need to disambiguate
72 // between such null string occurrences. Do that by converting the latter 74 // between such null string occurrences. Do that by converting the latter
73 // case's null strings into empty ones. 75 // case's null strings into empty ones.
74 if (source_.IsNull()) 76 if (source_.IsNull())
75 source_ = ""; 77 source_ = "";
76 } 78 }
77 79
78 } // namespace blink 80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698