Return unique_ptr from WebLocalFrame::CreateAssociatedURLLoader
Return std::unique_ptr<WebAssociatedURLLoader> instead of raw pointer from WebLocalFrame::CreateAssociatedURLLoader() R=kmoon@chromium.org Bug: 1127146 Change-Id: Iac86abe5d0e41468a9d1fb2dd610f2c5278da9ac Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500843 Reviewed-by: Kentaro Hara <haraken@chromium.org> Reviewed-by: K. Moon <kmoon@chromium.org> Commit-Queue: K. Moon <kmoon@chromium.org> Cr-Commit-Position: refs/heads/master@{#821912}
This commit is contained in:
components/nacl/renderer
content/renderer
extensions/renderer/guest_view/mime_handler_view
pdf
third_party/blink
public
renderer
@ -318,7 +318,7 @@ class ManifestServiceProxy : public ManifestServiceChannel::Delegate {
|
||||
DISALLOW_COPY_AND_ASSIGN(ManifestServiceProxy);
|
||||
};
|
||||
|
||||
blink::WebAssociatedURLLoader* CreateAssociatedURLLoader(
|
||||
std::unique_ptr<blink::WebAssociatedURLLoader> CreateAssociatedURLLoader(
|
||||
const blink::WebDocument& document,
|
||||
const GURL& gurl) {
|
||||
blink::WebAssociatedURLLoaderOptions options;
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/metrics/field_trial_params.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/task_runner_util.h"
|
||||
@ -118,7 +117,7 @@ class FrameFetchContext : public media::ResourceFetchContext {
|
||||
// media::ResourceFetchContext implementation.
|
||||
std::unique_ptr<blink::WebAssociatedURLLoader> CreateUrlLoader(
|
||||
const blink::WebAssociatedURLLoaderOptions& options) override {
|
||||
return base::WrapUnique(frame_->CreateAssociatedURLLoader(options));
|
||||
return frame_->CreateAssociatedURLLoader(options);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -300,7 +300,7 @@ int32_t PepperURLLoaderHost::InternalOnHostMsgOpen(
|
||||
}
|
||||
}
|
||||
|
||||
loader_.reset(frame->CreateAssociatedURLLoader(options));
|
||||
loader_ = frame->CreateAssociatedURLLoader(options);
|
||||
if (!loader_.get())
|
||||
return PP_ERROR_FAILED;
|
||||
|
||||
|
@ -354,7 +354,7 @@ void MimeHandlerViewContainer::SendResourceRequest() {
|
||||
|
||||
blink::WebAssociatedURLLoaderOptions options;
|
||||
DCHECK(!loader_);
|
||||
loader_.reset(frame->CreateAssociatedURLLoader(options));
|
||||
loader_ = frame->CreateAssociatedURLLoader(options);
|
||||
|
||||
// The embedded plugin is allowed to be cross-origin and we should always
|
||||
// send credentials/cookies with the request. So, use the default mode
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "base/check_op.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/notreached.h"
|
||||
#include "base/thread_annotations.h"
|
||||
#include "base/threading/thread_checker.h"
|
||||
@ -320,11 +319,9 @@ void PdfViewWebPlugin::SetReferrerForRequest(
|
||||
std::unique_ptr<blink::WebAssociatedURLLoader>
|
||||
PdfViewWebPlugin::CreateAssociatedURLLoader(
|
||||
const blink::WebAssociatedURLLoaderOptions& options) {
|
||||
// TODO(crbug.com/1127146): blink::WebLocalFrame::CreateAssociatedURLLoader()
|
||||
// really should return a std::unique_ptr instead.
|
||||
DCHECK(IsValid());
|
||||
return base::WrapUnique(
|
||||
container_->GetDocument().GetFrame()->CreateAssociatedURLLoader(options));
|
||||
return container_->GetDocument().GetFrame()->CreateAssociatedURLLoader(
|
||||
options);
|
||||
}
|
||||
|
||||
base::WeakPtr<PdfViewPluginBase> PdfViewWebPlugin::GetWeakPtr() {
|
||||
|
@ -631,7 +631,7 @@ class WebLocalFrame : public WebFrame {
|
||||
// loader will, for example, be cancelled when StopLoading is called.
|
||||
//
|
||||
// FIXME: StopLoading does not yet cancel an associated loader!!
|
||||
virtual WebAssociatedURLLoader* CreateAssociatedURLLoader(
|
||||
virtual std::unique_ptr<WebAssociatedURLLoader> CreateAssociatedURLLoader(
|
||||
const WebAssociatedURLLoaderOptions&) = 0;
|
||||
|
||||
// This API is deprecated and only required by PepperURLLoaderHost::Close()
|
||||
|
@ -1073,9 +1073,11 @@ void WebLocalFrameImpl::SetReferrerForRequest(WebURLRequest& request,
|
||||
resource_request.SetReferrerString(referrer);
|
||||
}
|
||||
|
||||
WebAssociatedURLLoader* WebLocalFrameImpl::CreateAssociatedURLLoader(
|
||||
std::unique_ptr<WebAssociatedURLLoader>
|
||||
WebLocalFrameImpl::CreateAssociatedURLLoader(
|
||||
const WebAssociatedURLLoaderOptions& options) {
|
||||
return new WebAssociatedURLLoaderImpl(GetFrame()->DomWindow(), options);
|
||||
return std::make_unique<WebAssociatedURLLoaderImpl>(GetFrame()->DomWindow(),
|
||||
options);
|
||||
}
|
||||
|
||||
void WebLocalFrameImpl::DeprecatedStopLoading() {
|
||||
|
@ -270,7 +270,7 @@ class CORE_EXPORT WebLocalFrameImpl final
|
||||
scheduler::WebAgentGroupScheduler* GetAgentGroupScheduler() const override;
|
||||
scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(TaskType) override;
|
||||
WebInputMethodController* GetInputMethodController() override;
|
||||
WebAssociatedURLLoader* CreateAssociatedURLLoader(
|
||||
std::unique_ptr<WebAssociatedURLLoader> CreateAssociatedURLLoader(
|
||||
const WebAssociatedURLLoaderOptions&) override;
|
||||
void DeprecatedStopLoading() override;
|
||||
WebSize GetScrollOffset() const override;
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "build/build_config.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -119,7 +118,7 @@ class WebAssociatedURLLoaderTest : public testing::Test,
|
||||
std::unique_ptr<WebAssociatedURLLoader> CreateAssociatedURLLoader(
|
||||
const WebAssociatedURLLoaderOptions options =
|
||||
WebAssociatedURLLoaderOptions()) {
|
||||
return base::WrapUnique(MainFrame()->CreateAssociatedURLLoader(options));
|
||||
return MainFrame()->CreateAssociatedURLLoader(options);
|
||||
}
|
||||
|
||||
// WebAssociatedURLLoaderClient implementation.
|
||||
|
Reference in New Issue
Block a user