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

Side by Side Diff: third_party/WebKit/Source/core/loader/resource/ScriptResource.cpp

Issue 2807343002: Rename ScriptResource/WorkerScriptLoader::Script() to SourceText() (Closed)
Patch Set: Created 3 years, 8 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ResourceClientWalker<ScriptResourceClient> walker(Clients()); 70 ResourceClientWalker<ScriptResourceClient> walker(Clients());
71 while (ScriptResourceClient* client = walker.Next()) 71 while (ScriptResourceClient* client = walker.Next())
72 client->NotifyAppendData(this); 72 client->NotifyAppendData(this);
73 } 73 }
74 74
75 void ScriptResource::OnMemoryDump(WebMemoryDumpLevelOfDetail level_of_detail, 75 void ScriptResource::OnMemoryDump(WebMemoryDumpLevelOfDetail level_of_detail,
76 WebProcessMemoryDump* memory_dump) const { 76 WebProcessMemoryDump* memory_dump) const {
77 Resource::OnMemoryDump(level_of_detail, memory_dump); 77 Resource::OnMemoryDump(level_of_detail, memory_dump);
78 const String name = GetMemoryDumpName() + "/decoded_script"; 78 const String name = GetMemoryDumpName() + "/decoded_script";
79 auto dump = memory_dump->CreateMemoryAllocatorDump(name); 79 auto dump = memory_dump->CreateMemoryAllocatorDump(name);
80 dump->AddScalar("size", "bytes", script_.CharactersSizeInBytes()); 80 dump->AddScalar("size", "bytes", source_text_.CharactersSizeInBytes());
81 memory_dump->AddSuballocation( 81 memory_dump->AddSuballocation(
82 dump->Guid(), String(WTF::Partitions::kAllocatedObjectPoolName)); 82 dump->Guid(), String(WTF::Partitions::kAllocatedObjectPoolName));
83 } 83 }
84 84
85 const String& ScriptResource::Script() { 85 const String& ScriptResource::SourceText() {
86 DCHECK(IsLoaded()); 86 DCHECK(IsLoaded());
87 87
88 if (script_.IsNull() && Data()) { 88 if (source_text_.IsNull() && Data()) {
89 String script = DecodedText(); 89 String source_text = DecodedText();
90 ClearData(); 90 ClearData();
91 SetDecodedSize(script.CharactersSizeInBytes()); 91 SetDecodedSize(source_text.CharactersSizeInBytes());
92 script_ = AtomicString(script); 92 source_text_ = AtomicString(source_text);
93 } 93 }
94 94
95 return script_; 95 return source_text_;
96 } 96 }
97 97
98 void ScriptResource::DestroyDecodedDataForFailedRevalidation() { 98 void ScriptResource::DestroyDecodedDataForFailedRevalidation() {
99 script_ = AtomicString(); 99 source_text_ = AtomicString();
100 } 100 }
101 101
102 // static 102 // static
103 bool ScriptResource::MimeTypeAllowedByNosniff( 103 bool ScriptResource::MimeTypeAllowedByNosniff(
104 const ResourceResponse& response) { 104 const ResourceResponse& response) {
105 return ParseContentTypeOptionsHeader( 105 return ParseContentTypeOptionsHeader(
106 response.HttpHeaderField(HTTPNames::X_Content_Type_Options)) != 106 response.HttpHeaderField(HTTPNames::X_Content_Type_Options)) !=
107 kContentTypeOptionsNosniff || 107 kContentTypeOptionsNosniff ||
108 MIMETypeRegistry::IsSupportedJavaScriptMIMEType( 108 MIMETypeRegistry::IsSupportedJavaScriptMIMEType(
109 response.HttpContentType()); 109 response.HttpContentType());
(...skipping 10 matching lines...) Expand all
120 return kSharableCrossOrigin; 120 return kSharableCrossOrigin;
121 } 121 }
122 122
123 if (PassesAccessControlCheck(security_origin)) 123 if (PassesAccessControlCheck(security_origin))
124 return kSharableCrossOrigin; 124 return kSharableCrossOrigin;
125 125
126 return kNotSharableCrossOrigin; 126 return kNotSharableCrossOrigin;
127 } 127 }
128 128
129 } // namespace blink 129 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698