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

Side by Side Diff: Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 708093002: Script streaming: remove byte order marks, detect encoding based on them. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 ASSERT(streamer->isFinished()); 122 ASSERT(streamer->isFinished());
123 ASSERT(!streamer->streamingSuppressed()); 123 ASSERT(!streamer->streamingSuppressed());
124 script = v8::ScriptCompiler::Compile(isolate, streamer->source(), code, origin); 124 script = v8::ScriptCompiler::Compile(isolate, streamer->source(), code, origin);
125 // Whether to produce the cached data or not is decided when the 125 // Whether to produce the cached data or not is decided when the
126 // streamer is started. Here we only need to get the data out. 126 // streamer is started. Here we only need to get the data out.
127 const v8::ScriptCompiler::CachedData* newCachedData = streamer->source() ->GetCachedData(); 127 const v8::ScriptCompiler::CachedData* newCachedData = streamer->source() ->GetCachedData();
128 if (newCachedData) { 128 if (newCachedData) {
129 resource->clearCachedMetadata(); 129 resource->clearCachedMetadata();
130 // Temporarily disable cached metadata for streaming; it's 130 // Temporarily disable cached metadata for streaming; it's
131 // producing broken data. FIXME: enable it again. 131 // producing broken data. FIXME: enable it again.
132 // resource->setCachedMetadata(streamer->cachedDataType(), reinterpr et_cast<const char*>(newCachedData->data), newCachedData->length); 132 resource->setCachedMetadata(streamer->cachedDataType(), reinterpret_ cast<const char*>(newCachedData->data), newCachedData->length);
133 } 133 }
134 } else if (!resource || !resource->url().protocolIsInHTTPFamily() || code->L ength() < 1024) { 134 } else if (!resource || !resource->url().protocolIsInHTTPFamily() || code->L ength() < 1024) {
135 v8::ScriptCompiler::Source source(code, origin); 135 v8::ScriptCompiler::Source source(code, origin);
136 script = v8::ScriptCompiler::Compile(isolate, &source, v8::ScriptCompile r::kNoCompileOptions); 136 script = v8::ScriptCompiler::Compile(isolate, &source, v8::ScriptCompile r::kNoCompileOptions);
137 } else { 137 } else {
138 switch (cacheOptions) { 138 switch (cacheOptions) {
139 case V8CacheOptionsParse: 139 case V8CacheOptionsParse:
140 cacheTag = tagForParserCache(); 140 cacheTag = tagForParserCache();
141 script = resource->cachedMetadata(cacheTag) 141 script = resource->cachedMetadata(cacheTag)
142 ? compileAndConsumeCache(isolate, code, origin, resource, v8::Sc riptCompiler::kConsumeParserCache, cacheTag) 142 ? compileAndConsumeCache(isolate, code, origin, resource, v8::Sc riptCompiler::kConsumeParserCache, cacheTag)
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 { 292 {
293 return StringHash::hash(v8::V8::GetVersion()) * 2; 293 return StringHash::hash(v8::V8::GetVersion()) * 2;
294 } 294 }
295 295
296 unsigned V8ScriptRunner::tagForCodeCache() 296 unsigned V8ScriptRunner::tagForCodeCache()
297 { 297 {
298 return StringHash::hash(v8::V8::GetVersion()) * 2 + 1; 298 return StringHash::hash(v8::V8::GetVersion()) * 2 + 1;
299 } 299 }
300 300
301 } // namespace blink 301 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698