Set Ready For Review
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hi, I am raising the CL for background compile again
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
<token key="State">
<variant name="Success"
summary="Script was successfully compiled in the background."/>
<variant name="TimedOut"
summary="Main thread timed out while waiting for background
compilation to finish."/>
</token>nit: apologies I didn't notice this before, but this and the duplicate below can be deduplicated using the variant syntax. See `<variants name="ChannelType">...</variant>` at the top of the file for an example for how it's done.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
v8 lgtm
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
<token key="State">
<variant name="Success"
summary="Script was successfully compiled in the background."/>
<variant name="TimedOut"
summary="Main thread timed out while waiting for background
compilation to finish."/>
</token>nit: apologies I didn't notice this before, but this and the duplicate below can be deduplicated using the variant syntax. See `<variants name="ChannelType">...</variant>` at the top of the file for an example for how it's done.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
task_runner->PostNonNestableTask(Is it necessary to post back to main for this? UMA histograms are thread-safe; is TimedOut not safe to access from the other thread for some reason?
PostCrossThreadTask(
*task_runner_, FROM_HERE,
CrossThreadBindOnce(
[](scoped_refptr<BackgroundInlineScriptStreamer> streamer,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
streamer->Run();
task_runner->PostNonNestableTask(
FROM_HERE,
ConvertToBaseOnceCallback(CrossThreadBindOnce(
&EmitHTMLInlineCompilationHistograms,
std::move(streamer))));
},
streamer, main_thread_task_runner_));
} else {
worker_pool::PostTask(
FROM_HERE, {base::TaskPriority::USER_BLOCKING},
CrossThreadBindOnce(
[](scoped_refptr<BackgroundInlineScriptStreamer> streamer,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
streamer->Run();
task_runner->PostNonNestableTask(
FROM_HERE,
ConvertToBaseOnceCallback(CrossThreadBindOnce(
&EmitHTMLInlineCompilationHistograms,
std::move(streamer))));
},
streamer, main_thread_task_runner_));Are these branches identical except for where the task is posted? If so, could we move the CrossThreadBindOnce outside it, so only the PostCrossThreadTask or worker_pool::PostTask is in the if statement?
(They were duplicated before but they were pretty trivial at the time.)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Is it necessary to post back to main for this? UMA histograms are thread-safe; is TimedOut not safe to access from the other thread for some reason?
You're correct that UMA histograms are thread-safe. I was following the pattern on extension_script_streamer.cc, but it seems there is a little more complex, since they access ElapsedTime and source_ and explicitly mention that it needs to be done in the main thread
PostCrossThreadTask(Are these branches identical except for where the task is posted? If so, could we move the CrossThreadBindOnce outside it, so only the PostCrossThreadTask or worker_pool::PostTask is in the if statement?
(They were duplicated before but they were pretty trivial at the time.)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
scoped_refptr<BackgroundInlineScriptStreamer> script_streamer) {nit: It's a bit weird for this to take ownership, since it only reads `const BackgroundInlineScriptStreamer&` would be simpler.
auto emit_histograms_callback = CrossThreadBindOnce(While this does emit histograms, I assume the main purpose is Run(), so we should name it for that instead.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
scoped_refptr<BackgroundInlineScriptStreamer> script_streamer) {nit: It's a bit weird for this to take ownership, since it only reads `const BackgroundInlineScriptStreamer&` would be simpler.
I am passing a boolean now
While this does emit histograms, I assume the main purpose is Run(), so we should name it for that instead.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
extensions LGTM; extensions code is unchanged from https://chromium-review.googlesource.com/c/chromium/src/+/6820371
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@jbr...@chromium.org @les...@chromium.org I wait for you look in the latest changes
| Code-Review | +1 |
@jbr...@chromium.org @les...@chromium.org I wait for you look in the latest changes
| Code-Review | +1 |
Background compile JS extension scripts injected at document start
Re open for the CL
https://chromium-review.googlesource.com/c/chromium/src/+/6820371
Currently, parsing/compiling of JS scripts injected by extensions to run
at document start is performed in the main thread, affecting the
performance of all pages. This could be improved by starting the
compilation in the background thread earlier in the compilation process.
This CL makes changes to extensions/ and blink/ to make this happen:
Extensions:
- Add logic to ExtensionFrameHelper::ReadyToCommitNavigation to start
the background compilation.
- Add logic to ScriptInjection::InjectJs to add the streamer to the
corresponding blink::WebScriptSource objects.
Blink
- Add a public ExtensionScriptStreamer so that extensions can start
the streaming and blink::WebScriptSource can hold a reference to
blink::BackgroundInlineScriptStreamer.
- Modify blink::ClassicScript::CreateUnspecifiedScript to accept a
ScriptStreamer argument.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |