| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "core/loader/DocumentLoader.h" | 46 #include "core/loader/DocumentLoader.h" |
| 47 #include "core/loader/LinkLoader.h" | 47 #include "core/loader/LinkLoader.h" |
| 48 #include "core/loader/NavigationScheduler.h" | 48 #include "core/loader/NavigationScheduler.h" |
| 49 #include "platform/Histogram.h" | 49 #include "platform/Histogram.h" |
| 50 #include "platform/SharedBuffer.h" | 50 #include "platform/SharedBuffer.h" |
| 51 #include "platform/ThreadSafeFunctional.h" | 51 #include "platform/ThreadSafeFunctional.h" |
| 52 #include "platform/TraceEvent.h" | 52 #include "platform/TraceEvent.h" |
| 53 #include "platform/heap/Handle.h" | 53 #include "platform/heap/Handle.h" |
| 54 #include "public/platform/Platform.h" | 54 #include "public/platform/Platform.h" |
| 55 #include "public/platform/WebFrameScheduler.h" | 55 #include "public/platform/WebFrameScheduler.h" |
| 56 #include "public/platform/WebLoadingBehaviorFlag.h" |
| 56 #include "public/platform/WebScheduler.h" | 57 #include "public/platform/WebScheduler.h" |
| 57 #include "public/platform/WebThread.h" | 58 #include "public/platform/WebThread.h" |
| 58 #include "wtf/RefCounted.h" | 59 #include "wtf/RefCounted.h" |
| 59 #include "wtf/TemporaryChange.h" | 60 #include "wtf/TemporaryChange.h" |
| 60 | 61 |
| 61 namespace blink { | 62 namespace blink { |
| 62 | 63 |
| 63 using namespace HTMLNames; | 64 using namespace HTMLNames; |
| 64 | 65 |
| 65 // This is a direct transcription of step 4 from: | 66 // This is a direct transcription of step 4 from: |
| (...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 m_options, | 1156 m_options, |
| 1156 document()->url(), | 1157 document()->url(), |
| 1157 CachedDocumentParameters::create(document()), | 1158 CachedDocumentParameters::create(document()), |
| 1158 MediaValuesCached::MediaValuesCachedData(*document())); | 1159 MediaValuesCached::MediaValuesCachedData(*document())); |
| 1159 } | 1160 } |
| 1160 | 1161 |
| 1161 void HTMLDocumentParser::evaluateAndPreloadScriptForDocumentWrite(const String&
source) | 1162 void HTMLDocumentParser::evaluateAndPreloadScriptForDocumentWrite(const String&
source) |
| 1162 { | 1163 { |
| 1163 if (!m_evaluator->shouldEvaluate(source)) | 1164 if (!m_evaluator->shouldEvaluate(source)) |
| 1164 return; | 1165 return; |
| 1166 document()->loader()->didObserveLoadingBehavior(WebLoadingBehaviorFlag::WebL
oadingBehaviorDocumentWriteEvaluator); |
| 1167 if (!RuntimeEnabledFeatures::documentWriteEvaluatorEnabled()) |
| 1168 return; |
| 1165 TRACE_EVENT0("blink", "HTMLDocumentParser::evaluateAndPreloadScriptForDocume
ntWrite"); | 1169 TRACE_EVENT0("blink", "HTMLDocumentParser::evaluateAndPreloadScriptForDocume
ntWrite"); |
| 1166 | 1170 |
| 1167 double initializeStartTime = monotonicallyIncreasingTimeMS(); | 1171 double initializeStartTime = monotonicallyIncreasingTimeMS(); |
| 1168 bool neededInitialization = m_evaluator->ensureEvaluationContext(); | 1172 bool neededInitialization = m_evaluator->ensureEvaluationContext(); |
| 1169 double initializationDuration = monotonicallyIncreasingTimeMS() - initialize
StartTime; | 1173 double initializationDuration = monotonicallyIncreasingTimeMS() - initialize
StartTime; |
| 1170 | 1174 |
| 1171 double startTime = monotonicallyIncreasingTimeMS(); | 1175 double startTime = monotonicallyIncreasingTimeMS(); |
| 1172 String writtenSource = m_evaluator->evaluateAndEmitWrittenSource(source); | 1176 String writtenSource = m_evaluator->evaluateAndEmitWrittenSource(source); |
| 1173 double duration = monotonicallyIncreasingTimeMS() - startTime; | 1177 double duration = monotonicallyIncreasingTimeMS() - startTime; |
| 1174 | 1178 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1189 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); | 1193 DEFINE_STATIC_LOCAL(CustomCountHistogram, successHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Success", 1, 10000, 50)); |
| 1190 successHistogram.count(duration); | 1194 successHistogram.count(duration); |
| 1191 } else { | 1195 } else { |
| 1192 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); | 1196 DEFINE_STATIC_LOCAL(CustomCountHistogram, failureHistogram, ("PreloadSca
nner.DocumentWrite.ExecutionTime.Failure", 1, 10000, 50)); |
| 1193 failureHistogram.count(duration); | 1197 failureHistogram.count(duration); |
| 1194 } | 1198 } |
| 1195 | 1199 |
| 1196 } | 1200 } |
| 1197 | 1201 |
| 1198 } // namespace blink | 1202 } // namespace blink |
| OLD | NEW |