Commit d623f8a9 authored by Tsuyoshi Horo's avatar Tsuyoshi Horo Committed by Commit Bot

Stop unnecessary PostTask to UI thread in SXG related code

Before NavigationLoaderOnUI, SXG related code are executed on IO thread.
So we need to use PostTask() to UI thread to get FrameTreeNode.
But now they are executed on UI thread. We don't need to use PostTask().

Bug: 824854
Change-Id: I5bff6782ec0ba9bda0d9f930d13f92d009711cd6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1873814Reviewed-by: default avatarKunihiko Sakamoto <ksakamoto@chromium.org>
Commit-Queue: Tsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708506}
parent 97cffc5c
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/task/post_task.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/frame_host/frame_tree_node.h"
...@@ -518,12 +517,10 @@ void SignedExchangeHandler::OnCertReceived( ...@@ -518,12 +517,10 @@ void SignedExchangeHandler::OnCertReceived(
// property, or // property, or
const std::string& stapled_ocsp_response = unverified_cert_chain_->ocsp(); const std::string& stapled_ocsp_response = unverified_cert_chain_->ocsp();
base::PostTask( VerifyCert(certificate, url, stapled_ocsp_response, sct_list_from_cert_cbor,
FROM_HERE, {BrowserThread::UI}, frame_tree_node_id_,
base::BindOnce(&VerifyCert, certificate, url, stapled_ocsp_response, base::BindOnce(&SignedExchangeHandler::OnVerifyCert,
sct_list_from_cert_cbor, frame_tree_node_id_, weak_factory_.GetWeakPtr()));
base::BindOnce(&SignedExchangeHandler::OnVerifyCert,
weak_factory_.GetWeakPtr())));
} }
// https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#cross-origin-cert-req // https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#cross-origin-cert-req
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/task/post_task.h"
#include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/web_package/signed_exchange_utils.h" #include "content/browser/web_package/signed_exchange_utils.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
...@@ -118,8 +117,8 @@ bool ShouldDowngradeReport(const char* result_string, ...@@ -118,8 +117,8 @@ bool ShouldDowngradeReport(const char* result_string,
return false; return false;
} }
void ReportResultOnUI(int frame_tree_node_id, void ReportResult(int frame_tree_node_id,
network::mojom::SignedExchangeReportPtr report) { network::mojom::SignedExchangeReportPtr report) {
FrameTreeNode* frame_tree_node = FrameTreeNode* frame_tree_node =
FrameTreeNode::GloballyFindByID(frame_tree_node_id); FrameTreeNode::GloballyFindByID(frame_tree_node_id);
if (!frame_tree_node) if (!frame_tree_node)
...@@ -212,9 +211,7 @@ void SignedExchangeReporter::ReportResultAndFinish( ...@@ -212,9 +211,7 @@ void SignedExchangeReporter::ReportResultAndFinish(
report_->elapsed_time = base::TimeTicks::Now() - request_start_; report_->elapsed_time = base::TimeTicks::Now() - request_start_;
} }
base::PostTask(FROM_HERE, {BrowserThread::UI}, ReportResult(frame_tree_node_id_, std::move(report_));
base::BindOnce(&ReportResultOnUI, frame_tree_node_id_,
std::move(report_)));
} }
} // namespace content } // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment