Commit bf12f1e0 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Move DataURLToMessagePipeHandle() out of the Blink API

This function is used only in local_frame.cc past [1]. This CL
moves it out of the Blink API, down to the aforemented file.

[1] https://crrev.com/c/2028708

BUG=919392, 1041083
R=haraken@chromium.org

Change-Id: I5f3a5167751f3e37142967d584ec4cf7c824af39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2056460
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743080}
parent a02ebc1f
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_URL_CONVERSION_H_ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_URL_CONVERSION_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_URL_CONVERSION_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_URL_CONVERSION_H_
#include "mojo/public/cpp/system/message_pipe.h"
#include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_common.h"
class GURL; class GURL;
...@@ -16,13 +15,6 @@ class WebString; ...@@ -16,13 +15,6 @@ class WebString;
BLINK_PLATFORM_EXPORT GURL WebStringToGURL(const WebString&); BLINK_PLATFORM_EXPORT GURL WebStringToGURL(const WebString&);
// Convert a data url to a message pipe handle that corresponds to a remote
// blob, so that it can be passed across processes.
//
// TODO(crbug.com/1041083): Remove this method from the Blink public API.
BLINK_PLATFORM_EXPORT mojo::ScopedMessagePipeHandle DataURLToMessagePipeHandle(
const WebString&);
} // namespace blink } // namespace blink
#endif #endif
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <utility> #include <utility>
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "services/network/public/cpp/features.h" #include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/content_security_policy.mojom-blink.h" #include "services/network/public/mojom/content_security_policy.mojom-blink.h"
#include "skia/public/mojom/skcolor.mojom-blink.h" #include "skia/public/mojom/skcolor.mojom-blink.h"
...@@ -131,6 +132,7 @@ ...@@ -131,6 +132,7 @@
#include "third_party/blink/renderer/core/scroll/smooth_scroll_sequencer.h" #include "third_party/blink/renderer/core/scroll/smooth_scroll_sequencer.h"
#include "third_party/blink/renderer/core/svg/svg_document_extensions.h" #include "third_party/blink/renderer/core/svg/svg_document_extensions.h"
#include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h" #include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer.h" #include "third_party/blink/renderer/platform/graphics/graphics_layer.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h"
...@@ -167,6 +169,19 @@ inline float ParentTextZoomFactor(LocalFrame* frame) { ...@@ -167,6 +169,19 @@ inline float ParentTextZoomFactor(LocalFrame* frame) {
return parent_local_frame ? parent_local_frame->TextZoomFactor() : 1; return parent_local_frame ? parent_local_frame->TextZoomFactor() : 1;
} }
// Convert a data url to a message pipe handle that corresponds to a remote
// blob, so that it can be passed across processes.
mojo::ScopedMessagePipeHandle DataURLToMessagePipeHandle(
const String& data_url) {
auto blob_data = std::make_unique<BlobData>();
blob_data->AppendBytes(data_url.Utf8().data(), data_url.length());
scoped_refptr<BlobDataHandle> blob_data_handle =
BlobDataHandle::Create(std::move(blob_data), data_url.length());
mojo::PendingRemote<mojom::blink::Blob> data_url_blob =
blob_data_handle->CloneBlobRemote();
return data_url_blob.PassPipe();
}
} // namespace } // namespace
template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>; template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>;
...@@ -2224,7 +2239,7 @@ void LocalFrame::DownloadURL( ...@@ -2224,7 +2239,7 @@ void LocalFrame::DownloadURL(
return; return;
auto params = mojom::blink::DownloadURLParams::New(); auto params = mojom::blink::DownloadURLParams::New();
const WebURL& url = request.Url(); const KURL& url = request.Url();
// Pass data URL through blob. // Pass data URL through blob.
if (url.ProtocolIs("data")) { if (url.ProtocolIs("data")) {
params->url = KURL(); params->url = KURL();
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "third_party/blink/public/platform/url_conversion.h" #include "third_party/blink/public/platform/url_conversion.h"
#include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/platform/blob/blob_data.h"
#include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h" #include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -27,15 +26,4 @@ GURL WebStringToGURL(const WebString& web_string) { ...@@ -27,15 +26,4 @@ GURL WebStringToGURL(const WebString& web_string) {
return GURL(base::StringPiece16(str.Characters16(), str.length())); return GURL(base::StringPiece16(str.Characters16(), str.length()));
} }
mojo::ScopedMessagePipeHandle DataURLToMessagePipeHandle(
const WebString& data_url) {
auto blob_data = std::make_unique<blink::BlobData>();
blob_data->AppendBytes(data_url.Utf8().data(), data_url.length());
scoped_refptr<blink::BlobDataHandle> blob_data_handle =
blink::BlobDataHandle::Create(std::move(blob_data), data_url.length());
mojo::PendingRemote<mojom::blink::Blob> data_url_blob =
blob_data_handle->CloneBlobRemote();
return data_url_blob.PassPipe();
}
} // namespace blink } // namespace blink
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