diff options
Diffstat (limited to 'components/html_viewer')
34 files changed, 193 insertions, 159 deletions
diff --git a/components/html_viewer/ax_provider_apptest.cc b/components/html_viewer/ax_provider_apptest.cc index 588fad6..a8cd4e2 100644 --- a/components/html_viewer/ax_provider_apptest.cc +++ b/components/html_viewer/ax_provider_apptest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -90,23 +91,23 @@ TEST_F(AXProviderTest, HelloWorld) { mus::mojom::WindowTreeClientPtr tree_client; connection->ConnectToService(&tree_client); mus::Window* embed_window = window_manager()->NewWindow(); - embed_window->Embed(tree_client.Pass()); + embed_window->Embed(std::move(tree_client)); TestFrame frame; web_view::mojom::FramePtr frame_ptr; mojo::Binding<web_view::mojom::Frame> frame_binding(&frame); - frame_binding.Bind(GetProxy(&frame_ptr).Pass()); + frame_binding.Bind(GetProxy(&frame_ptr)); mojo::Array<web_view::mojom::FrameDataPtr> array(1u); - array[0] = web_view::mojom::FrameData::New().Pass(); + array[0] = web_view::mojom::FrameData::New(); array[0]->frame_id = embed_window->id(); array[0]->parent_id = 0u; web_view::mojom::FrameClientPtr frame_client; connection->ConnectToService(&frame_client); frame_client->OnConnect( - frame_ptr.Pass(), 1u, embed_window->id(), - web_view::mojom::WINDOW_CONNECT_TYPE_USE_NEW, array.Pass(), + std::move(frame_ptr), 1u, embed_window->id(), + web_view::mojom::WINDOW_CONNECT_TYPE_USE_NEW, std::move(array), base::TimeTicks::Now().ToInternalValue(), base::Closure()); // Connect to the AxProvider of the HTML document and get the AxTree. @@ -114,9 +115,9 @@ TEST_F(AXProviderTest, HelloWorld) { connection->ConnectToService(&ax_provider); Array<AxNodePtr> ax_tree; ax_provider->GetTree([&ax_tree](Array<AxNodePtr> tree) { - ax_tree = tree.Pass(); - EXPECT_TRUE(QuitRunLoop()); - }); + ax_tree = std::move(tree); + EXPECT_TRUE(QuitRunLoop()); + }); ASSERT_TRUE(DoRunLoopWithTimeout()); EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); diff --git a/components/html_viewer/ax_provider_impl.cc b/components/html_viewer/ax_provider_impl.cc index 8ef9ae7..84091c0 100644 --- a/components/html_viewer/ax_provider_impl.cc +++ b/components/html_viewer/ax_provider_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/ax_provider_impl.h" +#include <utility> + #include "components/html_viewer/blink_basic_type_converters.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/web/WebAXObject.h" @@ -20,12 +22,9 @@ using mojo::String; namespace html_viewer { -AxProviderImpl::AxProviderImpl( - WebView* web_view, - mojo::InterfaceRequest<mojo::AxProvider> request) - : web_view_(web_view), - binding_(this, request.Pass()) { -} +AxProviderImpl::AxProviderImpl(WebView* web_view, + mojo::InterfaceRequest<mojo::AxProvider> request) + : web_view_(web_view), binding_(this, std::move(request)) {} AxProviderImpl::~AxProviderImpl() { } @@ -37,7 +36,7 @@ void AxProviderImpl::GetTree( Array<AxNodePtr> result; Populate(web_view_->accessibilityObject(), 0, 0, &result); - callback.Run(result.Pass()); + callback.Run(std::move(result)); } int AxProviderImpl::Populate(const WebAXObject& ax_object, @@ -49,7 +48,7 @@ int AxProviderImpl::Populate(const WebAXObject& ax_object, if (ax_node.is_null()) return 0; - result->push_back(ax_node.Pass()); + result->push_back(std::move(ax_node)); unsigned num_children = ax_object.childCount(); next_sibling_id = 0; @@ -70,7 +69,7 @@ AxNodePtr AxProviderImpl::ConvertAxNode(const WebAXObject& ax_object, int next_sibling_id) { AxNodePtr result; if (!const_cast<WebAXObject&>(ax_object).updateLayoutAndCheckValidity()) - return result.Pass(); + return result; result = mojo::AxNode::New(); result->id = static_cast<int>(ax_object.axID()); @@ -89,7 +88,7 @@ AxNodePtr AxProviderImpl::ConvertAxNode(const WebAXObject& ax_object, } } - return result.Pass(); + return result; } } // namespace html_viewer diff --git a/components/html_viewer/ax_provider_impl_unittest.cc b/components/html_viewer/ax_provider_impl_unittest.cc index 5dca745..2d60f1e 100644 --- a/components/html_viewer/ax_provider_impl_unittest.cc +++ b/components/html_viewer/ax_provider_impl_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/message_loop/message_loop.h" @@ -75,7 +76,7 @@ class AxProviderImplTest : public testing::Test { }; struct NodeCatcher { - void OnNodes(Array<AxNodePtr> nodes) { this->nodes = nodes.Pass(); } + void OnNodes(Array<AxNodePtr> nodes) { this->nodes = std::move(nodes); } Array<AxNodePtr> nodes; }; @@ -99,7 +100,7 @@ AxNodePtr CreateNode(int id, node->text = mojo::AxText::New(); node->text->content = text; } - return node.Pass(); + return node; } } // namespace diff --git a/components/html_viewer/blink_basic_type_converters.cc b/components/html_viewer/blink_basic_type_converters.cc index b72946d..8d5c329 100644 --- a/components/html_viewer/blink_basic_type_converters.cc +++ b/components/html_viewer/blink_basic_type_converters.cc @@ -41,7 +41,7 @@ RectPtr TypeConverter<RectPtr, WebRect>::Convert(const WebRect& input) { result->y = input.y; result->width = input.width; result->height = input.height; - return result.Pass(); + return result; }; // static @@ -54,7 +54,7 @@ Array<uint8_t> TypeConverter<Array<uint8_t>, WebString>::Convert( static_assert(sizeof(uint8_t) == sizeof(char), "uint8_t must be the same size as an unsigned char"); memcpy(&result.front(), utf8.data(), utf8.size()); - return result.Pass(); + return result; } } // namespace mojo diff --git a/components/html_viewer/blink_basic_type_converters.h b/components/html_viewer/blink_basic_type_converters.h index 8dedb986a..bae9a78 100644 --- a/components/html_viewer/blink_basic_type_converters.h +++ b/components/html_viewer/blink_basic_type_converters.h @@ -5,12 +5,12 @@ #ifndef COMPONENTS_HTML_VIEWER_BLINK_BASIC_TYPE_CONVERTERS_H_ #define COMPONENTS_HTML_VIEWER_BLINK_BASIC_TYPE_CONVERTERS_H_ -#include "mojo/public/cpp/bindings/type_converter.h" - #include <stddef.h> #include <stdint.h> +#include <utility> #include "mojo/public/cpp/bindings/array.h" +#include "mojo/public/cpp/bindings/type_converter.h" #include "third_party/WebKit/public/platform/WebVector.h" #include "ui/mojo/geometry/geometry.mojom.h" @@ -50,7 +50,7 @@ struct TypeConverter<Array<T>, blink::WebVector<U> > { Array<T> array(vector.size()); for (size_t i = 0; i < vector.size(); ++i) array[i] = TypeConverter<T, U>::Convert(vector[i]); - return array.Pass(); + return std::move(array); } }; diff --git a/components/html_viewer/blink_platform_impl.cc b/components/html_viewer/blink_platform_impl.cc index 19604d2..d8d7812 100644 --- a/components/html_viewer/blink_platform_impl.cc +++ b/components/html_viewer/blink_platform_impl.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/blink_platform_impl.h" #include <cmath> +#include <utility> #include "base/command_line.h" #include "base/macros.h" @@ -84,11 +85,11 @@ BlinkPlatformImpl::BlinkPlatformImpl( mojo::CookieStorePtr cookie_store; connection->ConnectToService(&cookie_store); - cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); + cookie_jar_.reset(new WebCookieJarImpl(std::move(cookie_store))); mojo::ClipboardPtr clipboard; app->ConnectToService("mojo:clipboard", &clipboard); - clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); + clipboard_.reset(new WebClipboardImpl(std::move(clipboard))); } } diff --git a/components/html_viewer/blink_url_request_type_converters.cc b/components/html_viewer/blink_url_request_type_converters.cc index 1fe0c7c..141964d 100644 --- a/components/html_viewer/blink_url_request_type_converters.cc +++ b/components/html_viewer/blink_url_request_type_converters.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/blink_url_request_type_converters.h" #include <stdint.h> +#include <utility> #include "base/strings/string_util.h" #include "mojo/public/cpp/system/data_pipe.h" @@ -31,7 +32,7 @@ class HeaderFlattener : public blink::WebHTTPHeaderVisitor { HttpHeaderPtr header = HttpHeader::New(); header->name = name_latin1; header->value = value_latin1; - buffer_.push_back(header.Pass()); + buffer_.push_back(std::move(header)); } Array<HttpHeaderPtr> GetBuffer() { @@ -41,10 +42,10 @@ class HeaderFlattener : public blink::WebHTTPHeaderVisitor { HttpHeaderPtr header = HttpHeader::New(); header->name = "Accept"; header->value = "*/*"; - buffer_.push_back(header.Pass()); + buffer_.push_back(std::move(header)); has_accept_header_ = true; } - return buffer_.Pass(); + return std::move(buffer_); } private: @@ -72,8 +73,7 @@ void AddRequestBody(URLRequest* url_request, options.element_num_bytes = 1; options.capacity_num_bytes = num_bytes; DataPipe data_pipe(options); - url_request->body.push_back( - data_pipe.consumer_handle.Pass()); + url_request->body.push_back(std::move(data_pipe.consumer_handle)); WriteDataRaw(data_pipe.producer_handle.get(), element.data.data(), &num_bytes, @@ -102,11 +102,11 @@ URLRequestPtr TypeConverter<URLRequestPtr, blink::WebURLRequest>::Convert( HeaderFlattener flattener; request.visitHTTPHeaderFields(&flattener); - url_request->headers = flattener.GetBuffer().Pass(); + url_request->headers = flattener.GetBuffer(); AddRequestBody(url_request.get(), request); - return url_request.Pass(); + return url_request; } } // namespace mojo diff --git a/components/html_viewer/content_handler_impl.cc b/components/html_viewer/content_handler_impl.cc index 2fdcdbf..fc97032 100644 --- a/components/html_viewer/content_handler_impl.cc +++ b/components/html_viewer/content_handler_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/content_handler_impl.h" +#include <utility> + #include "components/html_viewer/html_document_application_delegate.h" namespace html_viewer { @@ -14,9 +16,8 @@ ContentHandlerImpl::ContentHandlerImpl( mojo::InterfaceRequest<mojo::ContentHandler> request) : global_state_(global_state), app_(app), - binding_(this, request.Pass()), - app_refcount_(app_->app_lifetime_helper()->CreateAppRefCount()) { -} + binding_(this, std::move(request)), + app_refcount_(app_->app_lifetime_helper()->CreateAppRefCount()) {} ContentHandlerImpl::~ContentHandlerImpl() { } @@ -27,7 +28,7 @@ void ContentHandlerImpl::StartApplication( const mojo::Callback<void()>& destruct_callback) { // HTMLDocumentApplicationDelegate deletes itself. new HTMLDocumentApplicationDelegate( - request.Pass(), response.Pass(), global_state_, + std::move(request), std::move(response), global_state_, app_->app_lifetime_helper()->CreateAppRefCount(), destruct_callback); } diff --git a/components/html_viewer/devtools_agent_impl.cc b/components/html_viewer/devtools_agent_impl.cc index a547062..2cf2e89 100644 --- a/components/html_viewer/devtools_agent_impl.cc +++ b/components/html_viewer/devtools_agent_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/devtools_agent_impl.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "third_party/WebKit/public/platform/WebString.h" @@ -33,7 +35,7 @@ DevToolsAgentImpl::~DevToolsAgentImpl() { void DevToolsAgentImpl::BindToRequest( mojo::InterfaceRequest<DevToolsAgent> request) { - binding_.Bind(request.Pass()); + binding_.Bind(std::move(request)); } void DevToolsAgentImpl::SetClient( @@ -41,7 +43,7 @@ void DevToolsAgentImpl::SetClient( if (client_) frame_->devToolsAgent()->detach(); - client_ = client.Pass(); + client_ = std::move(client); client_.set_connection_error_handler(base::Bind( &DevToolsAgentImpl::OnConnectionError, base::Unretained(this))); diff --git a/components/html_viewer/discardable_memory_allocator.cc b/components/html_viewer/discardable_memory_allocator.cc index 45fdec6..8e97144 100644 --- a/components/html_viewer/discardable_memory_allocator.cc +++ b/components/html_viewer/discardable_memory_allocator.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/discardable_memory_allocator.h" #include <stdint.h> +#include <utility> #include "base/macros.h" #include "base/memory/discardable_memory.h" @@ -127,7 +128,7 @@ DiscardableMemoryAllocator::AllocateLockedDiscardableMemory(size_t size) { it = live_unlocked_chunks_.erase(it); } - return chunk.Pass(); + return std::move(chunk); } std::list<DiscardableMemoryAllocator::DiscardableMemoryChunkImpl*>::iterator diff --git a/components/html_viewer/document_resource_waiter.cc b/components/html_viewer/document_resource_waiter.cc index 7dbab7a..a9c3a0f 100644 --- a/components/html_viewer/document_resource_waiter.cc +++ b/components/html_viewer/document_resource_waiter.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/document_resource_waiter.h" +#include <utility> + #include "components/html_viewer/global_state.h" #include "components/html_viewer/html_document.h" #include "components/html_viewer/html_frame_tree_manager.h" @@ -18,7 +20,7 @@ DocumentResourceWaiter::DocumentResourceWaiter(GlobalState* global_state, HTMLDocument* document) : global_state_(global_state), document_(document), - response_(response.Pass()), + response_(std::move(response)), root_(nullptr), change_id_(0u), window_id_(0u), @@ -44,9 +46,9 @@ void DocumentResourceWaiter::Release( WindowConnectType* window_connect_type, OnConnectCallback* on_connect_callback) { DCHECK(is_ready_); - *frame_client_request = frame_client_request_.Pass(); - *frame = frame_.Pass(); - *frame_data = frame_data_.Pass(); + *frame_client_request = std::move(frame_client_request_); + *frame = std::move(frame_); + *frame_data = std::move(frame_data_); *change_id = change_id_; *window_id = window_id_; *window_connect_type = window_connect_type_; @@ -54,7 +56,7 @@ void DocumentResourceWaiter::Release( } mojo::URLResponsePtr DocumentResourceWaiter::ReleaseURLResponse() { - return response_.Pass(); + return std::move(response_); } void DocumentResourceWaiter::SetRoot(mus::Window* root) { @@ -70,7 +72,7 @@ void DocumentResourceWaiter::Bind( DVLOG(1) << "Request for FrameClient after already supplied one"; return; } - frame_client_binding_.Bind(request.Pass()); + frame_client_binding_.Bind(std::move(request)); } void DocumentResourceWaiter::UpdateIsReady() { @@ -133,8 +135,8 @@ void DocumentResourceWaiter::OnConnect( change_id_ = change_id; window_id_ = window_id; window_connect_type_ = window_connect_type; - frame_ = frame.Pass(); - frame_data_ = frame_data.Pass(); + frame_ = std::move(frame); + frame_data_ = std::move(frame_data); navigation_start_time_ = base::TimeTicks::FromInternalValue(navigation_start_time_ticks); on_connect_callback_ = callback; diff --git a/components/html_viewer/global_state.cc b/components/html_viewer/global_state.cc index 9d78811..5b4999e 100644 --- a/components/html_viewer/global_state.cc +++ b/components/html_viewer/global_state.cc @@ -5,8 +5,8 @@ #include "components/html_viewer/global_state.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -163,7 +163,7 @@ void GlobalState::InitIfNecessary(const gfx::Size& screen_size_in_pixels, ui::RegisterPathProvider(); base::File pak_file_2 = pak_file.Duplicate(); ui::ResourceBundle::InitSharedInstanceWithPakFileRegion( - pak_file_2.Pass(), base::MemoryMappedFile::Region::kWholeFile); + std::move(pak_file_2), base::MemoryMappedFile::Region::kWholeFile); } mojo::InitLogging(); @@ -175,7 +175,7 @@ void GlobalState::InitIfNecessary(const gfx::Size& screen_size_in_pixels, // TODO(sky): why is this always using 100? ui::ResourceBundle::GetSharedInstance().AddDataPackFromFile( - pak_file.Pass(), ui::SCALE_FACTOR_100P); + std::move(pak_file), ui::SCALE_FACTOR_100P); compositor_thread_.Start(); @@ -198,7 +198,7 @@ const mus::mojom::GpuInfo* GlobalState::GetGpuInfo() { void GlobalState::GetGpuInfoCallback(mus::mojom::GpuInfoPtr gpu_info) { CHECK(gpu_info); - gpu_info_ = gpu_info.Pass(); + gpu_info_ = std::move(gpu_info); gpu_service_.reset(); } diff --git a/components/html_viewer/html_document.cc b/components/html_viewer/html_document.cc index f9742b0..b515444 100644 --- a/components/html_viewer/html_document.cc +++ b/components/html_viewer/html_document.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/html_document.h" +#include <utility> + #include "base/command_line.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -86,7 +88,7 @@ HTMLDocument::TransferableState::~TransferableState() {} void HTMLDocument::TransferableState::Move(TransferableState* other) { owns_window_tree_connection = other->owns_window_tree_connection; root = other->root; - window_tree_delegate_impl = other->window_tree_delegate_impl.Pass(); + window_tree_delegate_impl = std::move(other->window_tree_delegate_impl); other->root = nullptr; other->owns_window_tree_connection = false; @@ -114,7 +116,7 @@ HTMLDocument::HTMLDocument(mojo::ApplicationImpl* html_document_app, connection->AddService<TestHTMLViewer>(this); resource_waiter_.reset( - new DocumentResourceWaiter(global_state_, response.Pass(), this)); + new DocumentResourceWaiter(global_state_, std::move(response), this)); } void HTMLDocument::Destroy() { @@ -161,13 +163,12 @@ void HTMLDocument::Load() { } scoped_ptr<WebURLRequestExtraData> extra_data(new WebURLRequestExtraData); - extra_data->synthetic_response = - resource_waiter_->ReleaseURLResponse().Pass(); + extra_data->synthetic_response = resource_waiter_->ReleaseURLResponse(); base::TimeTicks navigation_start_time = resource_waiter_->navigation_start_time(); frame_ = HTMLFrameTreeManager::CreateFrameAndAttachToTree( - global_state_, window, resource_waiter_.Pass(), this); + global_state_, window, std::move(resource_waiter_), this); // If the frame wasn't created we can destroy ourself. if (!frame_) { @@ -177,7 +178,8 @@ void HTMLDocument::Load() { if (devtools_agent_request_.is_pending()) { if (frame_->devtools_agent()) { - frame_->devtools_agent()->BindToRequest(devtools_agent_request_.Pass()); + frame_->devtools_agent()->BindToRequest( + std::move(devtools_agent_request_)); } else { devtools_agent_request_ = mojo::InterfaceRequest<devtools_service::DevToolsAgent>(); @@ -213,19 +215,19 @@ void HTMLDocument::OnConnectionLost(mus::WindowTreeConnection* connection) { void HTMLDocument::OnFrameDidFinishLoad() { TRACE_EVENT0("html_viewer", "HTMLDocument::OnFrameDidFinishLoad"); did_finish_local_frame_load_ = true; - scoped_ptr<BeforeLoadCache> before_load_cache = before_load_cache_.Pass(); + scoped_ptr<BeforeLoadCache> before_load_cache = std::move(before_load_cache_); if (!before_load_cache) return; // Bind any pending AxProvider and TestHTMLViewer interface requests. for (auto it : before_load_cache->ax_provider_requests) { ax_providers_.insert(new AxProviderImpl( - frame_->frame_tree_manager()->GetWebView(), it->Pass())); + frame_->frame_tree_manager()->GetWebView(), std::move(*it))); } for (auto it : before_load_cache->test_interface_requests) { CHECK(IsTestInterfaceEnabled()); test_html_viewers_.push_back(new TestHTMLViewerImpl( - frame_->web_frame()->toWebLocalFrame(), it->Pass())); + frame_->web_frame()->toWebLocalFrame(), std::move(*it))); } } @@ -275,11 +277,11 @@ void HTMLDocument::Create(mojo::ApplicationConnection* connection, if (!did_finish_local_frame_load_) { // Cache AxProvider interface requests until the document finishes loading. auto cached_request = new mojo::InterfaceRequest<AxProvider>(); - *cached_request = request.Pass(); + *cached_request = std::move(request); GetBeforeLoadCache()->ax_provider_requests.insert(cached_request); } else { ax_providers_.insert( - new AxProviderImpl(frame_->web_view(), request.Pass())); + new AxProviderImpl(frame_->web_view(), std::move(request))); } } @@ -288,11 +290,11 @@ void HTMLDocument::Create(mojo::ApplicationConnection* connection, CHECK(IsTestInterfaceEnabled()); if (!did_finish_local_frame_load_) { auto cached_request = new mojo::InterfaceRequest<TestHTMLViewer>(); - *cached_request = request.Pass(); + *cached_request = std::move(request); GetBeforeLoadCache()->test_interface_requests.insert(cached_request); } else { test_html_viewers_.push_back(new TestHTMLViewerImpl( - frame_->web_frame()->toWebLocalFrame(), request.Pass())); + frame_->web_frame()->toWebLocalFrame(), std::move(request))); } } @@ -303,7 +305,7 @@ void HTMLDocument::Create( DVLOG(1) << "Request for FrameClient after one already vended."; return; } - resource_waiter_->Bind(request.Pass()); + resource_waiter_->Bind(std::move(request)); } void HTMLDocument::Create( @@ -311,9 +313,9 @@ void HTMLDocument::Create( mojo::InterfaceRequest<devtools_service::DevToolsAgent> request) { if (frame_) { if (frame_->devtools_agent()) - frame_->devtools_agent()->BindToRequest(request.Pass()); + frame_->devtools_agent()->BindToRequest(std::move(request)); } else { - devtools_agent_request_ = request.Pass(); + devtools_agent_request_ = std::move(request); } } @@ -325,7 +327,7 @@ void HTMLDocument::Create( new WindowTreeDelegateImpl(this)); transferable_state_.owns_window_tree_connection = true; mus::WindowTreeConnection::Create( - transferable_state_.window_tree_delegate_impl.get(), request.Pass(), + transferable_state_.window_tree_delegate_impl.get(), std::move(request), mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } diff --git a/components/html_viewer/html_document_application_delegate.cc b/components/html_viewer/html_document_application_delegate.cc index d102ca1..79c2834 100644 --- a/components/html_viewer/html_document_application_delegate.cc +++ b/components/html_viewer/html_document_application_delegate.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/html_document_application_delegate.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "components/html_viewer/global_state.h" @@ -28,7 +30,7 @@ class HTMLDocumentApplicationDelegate::ServiceConnectorQueue requests_.swap(requests); for (Request* request : requests) { connection->GetLocalServiceProvider()->ConnectToService( - request->interface_name, request->handle.Pass()); + request->interface_name, std::move(request->handle)); } } @@ -44,8 +46,8 @@ class HTMLDocumentApplicationDelegate::ServiceConnectorQueue mojo::ScopedMessagePipeHandle handle) override { scoped_ptr<Request> request(new Request); request->interface_name = interface_name; - request->handle = handle.Pass(); - requests_.push_back(request.Pass()); + request->handle = std::move(handle); + requests_.push_back(std::move(request)); } ScopedVector<Request> requests_; @@ -60,12 +62,12 @@ HTMLDocumentApplicationDelegate::HTMLDocumentApplicationDelegate( scoped_ptr<mojo::AppRefCount> parent_app_refcount, const mojo::Callback<void()>& destruct_callback) : app_(this, - request.Pass(), + std::move(request), base::Bind(&HTMLDocumentApplicationDelegate::OnTerminate, base::Unretained(this))), - parent_app_refcount_(parent_app_refcount.Pass()), + parent_app_refcount_(std::move(parent_app_refcount)), url_(response->url), - initial_response_(response.Pass()), + initial_response_(std::move(response)), global_state_(global_state), html_factory_(this), destruct_callback_(destruct_callback), @@ -99,7 +101,7 @@ bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( mojo::ApplicationConnection* connection) { if (initial_response_) { OnResponseReceived(nullptr, mojo::URLLoaderPtr(), connection, nullptr, - initial_response_.Pass()); + std::move(initial_response_)); } else if (url_ == "about:blank") { // This is a little unfortunate. At the browser side, when starting a new // app for "about:blank", the application manager uses @@ -113,7 +115,7 @@ bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( response->status_code = 200; response->mime_type = "text/html"; OnResponseReceived(nullptr, mojo::URLLoaderPtr(), connection, nullptr, - response.Pass()); + std::move(response)); } else { // HTMLDocument provides services, but is created asynchronously. Queue up // requests until the HTMLDocument is created. @@ -136,7 +138,7 @@ bool HTMLDocumentApplicationDelegate::ConfigureIncomingConnection( scoped_ptr<mojo::AppRefCount> app_retainer( app_.app_lifetime_helper()->CreateAppRefCount()); raw_loader->Start( - request.Pass(), + std::move(request), base::Bind(&HTMLDocumentApplicationDelegate::OnResponseReceived, weak_factory_.GetWeakPtr(), base::Passed(&app_retainer), base::Passed(&loader), connection, @@ -160,7 +162,7 @@ void HTMLDocumentApplicationDelegate::OnResponseReceived( // HTMLDocument is destroyed when the hosting view is destroyed, or // explicitly from our destructor. HTMLDocument* document = new HTMLDocument( - &app_, connection, response.Pass(), global_state_, + &app_, connection, std::move(response), global_state_, base::Bind(&HTMLDocumentApplicationDelegate::OnHTMLDocumentDeleted2, base::Unretained(this)), html_factory_); diff --git a/components/html_viewer/html_frame.cc b/components/html_viewer/html_frame.cc index ca3ac28..3365852 100644 --- a/components/html_viewer/html_frame.cc +++ b/components/html_viewer/html_frame.cc @@ -5,9 +5,9 @@ #include "components/html_viewer/html_frame.h" #include <stddef.h> - #include <algorithm> #include <limits> +#include <utility> #include "base/bind.h" #include "base/single_thread_task_runner.h" @@ -355,8 +355,9 @@ blink::WebFrame* HTMLFrame::createChildFrame( child_frame->frame_client_binding_.reset( new mojo::Binding<web_view::mojom::FrameClient>( child_frame, mojo::GetProxy(&client_ptr))); - server_->OnCreatedFrame(GetProxy(&(child_frame->server_)), client_ptr.Pass(), - child_window->id(), client_properties.Pass()); + server_->OnCreatedFrame(GetProxy(&(child_frame->server_)), + std::move(client_ptr), child_window->id(), + std::move(client_properties)); return child_frame->web_frame_; } @@ -405,7 +406,7 @@ blink::WebNavigationPolicy HTMLFrame::decidePolicyForNavigation( base::TimeTicks::Now().ToInternalValue(); server_->RequestNavigate( WebNavigationPolicyToNavigationTarget(info.defaultPolicy), id_, - url_request.Pass()); + std::move(url_request)); // TODO(yzshen): crbug.com/532556 If the server side drops the request, // this frame will be in permenant-loading state. We should send a @@ -540,11 +541,11 @@ void HTMLFrame::Bind( web_view::mojom::FramePtr frame, mojo::InterfaceRequest<web_view::mojom::FrameClient> frame_client_request) { DCHECK(IsLocal()); - server_ = frame.Pass(); + server_ = std::move(frame); server_.set_connection_error_handler( base::Bind(&HTMLFrame::Close, base::Unretained(this))); frame_client_binding_.reset(new mojo::Binding<web_view::mojom::FrameClient>( - this, frame_client_request.Pass())); + this, std::move(frame_client_request))); } void HTMLFrame::SetValueFromClientProperty(const std::string& name, @@ -820,7 +821,8 @@ void HTMLFrame::OnConnect( void HTMLFrame::OnFrameAdded(uint32_t change_id, web_view::mojom::FrameDataPtr frame_data) { - frame_tree_manager_->ProcessOnFrameAdded(this, change_id, frame_data.Pass()); + frame_tree_manager_->ProcessOnFrameAdded(this, change_id, + std::move(frame_data)); } void HTMLFrame::OnFrameRemoved(uint32_t change_id, uint32_t frame_id) { @@ -830,8 +832,8 @@ void HTMLFrame::OnFrameRemoved(uint32_t change_id, uint32_t frame_id) { void HTMLFrame::OnFrameClientPropertyChanged(uint32_t frame_id, const mojo::String& name, mojo::Array<uint8_t> new_value) { - frame_tree_manager_->ProcessOnFrameClientPropertyChanged(this, frame_id, name, - new_value.Pass()); + frame_tree_manager_->ProcessOnFrameClientPropertyChanged( + this, frame_id, name, std::move(new_value)); } void HTMLFrame::OnPostMessageEvent(uint32_t source_frame_id, @@ -997,7 +999,7 @@ void HTMLFrame::postMessageEvent(blink::WebLocalFrame* source_web_frame, event->target_origin = mojo::String::From(target_origin.toString()); source_frame->server_->PostMessageEventToFrame(target_frame->id_, - event.Pass()); + std::move(event)); } void HTMLFrame::initializeChildFrame(const blink::WebRect& frame_rect, @@ -1017,7 +1019,7 @@ void HTMLFrame::navigate(const blink::WebURLRequest& request, mojo::URLRequestPtr url_request = mojo::URLRequest::From(request); GetServerFrame()->RequestNavigate( web_view::mojom::NAVIGATION_TARGET_TYPE_EXISTING_FRAME, id_, - url_request.Pass()); + std::move(url_request)); } void HTMLFrame::reload(bool ignore_cache, bool is_client_redirect) { diff --git a/components/html_viewer/html_frame_apptest.cc b/components/html_viewer/html_frame_apptest.cc index 6b611d6..f887ef3 100644 --- a/components/html_viewer/html_frame_apptest.cc +++ b/components/html_viewer/html_frame_apptest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/auto_reset.h" #include "base/bind.h" @@ -82,7 +83,7 @@ scoped_ptr<base::Value> ExecuteScript(ApplicationConnection* connection, }); if (!WindowServerTestBase::DoRunLoopWithTimeout()) ADD_FAILURE() << "Timed out waiting for execute to complete"; - return result.Pass(); + return result; } // FrameTreeDelegate that can block waiting for navigation to start. @@ -215,7 +216,7 @@ class HTMLFrameTest : public WindowServerTestBase { mojo::URLRequestPtr BuildRequestForURL(const std::string& url_string) { mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From(AddPortToString(url_string)); - return request.Pass(); + return request; } FrameConnection* InitFrameTree(mus::Window* view, @@ -234,8 +235,8 @@ class HTMLFrameTest : public WindowServerTestBase { FrameClient* frame_client = frame_connection->frame_client(); WindowTreeClientPtr tree_client = frame_connection->GetWindowTreeClient(); frame_tree_.reset(new FrameTree( - result->GetContentHandlerID(), view, tree_client.Pass(), - frame_tree_delegate_.get(), frame_client, frame_connection.Pass(), + result->GetContentHandlerID(), view, std::move(tree_client), + frame_tree_delegate_.get(), frame_client, std::move(frame_connection), Frame::ClientPropertyMap(), base::TimeTicks::Now())); frame_tree_delegate_->set_frame_tree(frame_tree_.get()); return result; diff --git a/components/html_viewer/html_frame_properties.cc b/components/html_viewer/html_frame_properties.cc index c176aac..d9e2707 100644 --- a/components/html_viewer/html_frame_properties.cc +++ b/components/html_viewer/html_frame_properties.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/html_frame_properties.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "base/pickle.h" @@ -28,7 +29,7 @@ namespace { mojo::Array<uint8_t> IntToClientPropertyArray(int value) { mojo::Array<uint8_t> value_array(sizeof(value)); memcpy(&(value_array.front()), &value, sizeof(value)); - return value_array.Pass(); + return value_array; } bool IntFromClientPropertyArray(const mojo::Array<uint8_t>& value_array, @@ -60,7 +61,7 @@ blink::WebString FrameNameFromClientProperty( mojo::Array<uint8_t> FrameTreeScopeToClientProperty( blink::WebTreeScopeType scope_type) { - return IntToClientPropertyArray(static_cast<int>(scope_type)).Pass(); + return IntToClientPropertyArray(static_cast<int>(scope_type)); } bool FrameTreeScopeFromClientProperty(const mojo::Array<uint8_t>& new_data, @@ -78,7 +79,7 @@ bool FrameTreeScopeFromClientProperty(const mojo::Array<uint8_t>& new_data, mojo::Array<uint8_t> FrameSandboxFlagsToClientProperty( blink::WebSandboxFlags flags) { - return IntToClientPropertyArray(static_cast<int>(flags)).Pass(); + return IntToClientPropertyArray(static_cast<int>(flags)); } bool FrameSandboxFlagsFromClientProperty(const mojo::Array<uint8_t>& new_data, @@ -111,7 +112,7 @@ mojo::Array<uint8_t> FrameOriginToClientProperty(blink::WebFrame* frame) { pickle.WriteUInt16(origin.port()); mojo::Array<uint8_t> origin_array(pickle.size()); memcpy(&(origin_array.front()), pickle.data(), pickle.size()); - return origin_array.Pass(); + return origin_array; } url::Origin FrameOriginFromClientProperty(const mojo::Array<uint8_t>& data) { @@ -150,7 +151,7 @@ void AddToClientPropertiesIfValid( mojo::Array<uint8_t> value, mojo::Map<mojo::String, mojo::Array<uint8_t>>* client_properties) { if (!value.is_null()) - (*client_properties)[name] = value.Pass(); + (*client_properties)[name] = std::move(value); } mojo::Array<uint8_t> GetValueFromClientProperties( @@ -158,7 +159,7 @@ mojo::Array<uint8_t> GetValueFromClientProperties( const mojo::Map<mojo::String, mojo::Array<uint8_t>>& properties) { auto iter = properties.find(name); return iter == properties.end() ? mojo::Array<uint8_t>() - : iter.GetValue().Clone().Pass(); + : iter.GetValue().Clone(); } } // namespace html_viewer diff --git a/components/html_viewer/html_frame_tree_manager.cc b/components/html_viewer/html_frame_tree_manager.cc index 1bf2228..58d7122 100644 --- a/components/html_viewer/html_frame_tree_manager.cc +++ b/components/html_viewer/html_frame_tree_manager.cc @@ -5,8 +5,8 @@ #include "components/html_viewer/html_frame_tree_manager.h" #include <stddef.h> - #include <algorithm> +#include <utility> #include "base/command_line.h" #include "base/logging.h" @@ -154,7 +154,7 @@ HTMLFrame* HTMLFrameTreeManager::CreateFrameAndAttachToTree( HTMLFrame* frame = frame_tree->root_->FindFrame(window_id); DCHECK(frame); - frame->Bind(server_frame.Pass(), frame_client_request.Pass()); + frame->Bind(std::move(server_frame), std::move(frame_client_request)); return frame; } @@ -379,7 +379,7 @@ void HTMLFrameTreeManager::ProcessOnFrameClientPropertyChanged( HTMLFrame* frame = root_->FindFrame(frame_id); if (frame) - frame->SetValueFromClientProperty(name, new_data.Pass()); + frame->SetValueFromClientProperty(name, std::move(new_data)); } HTMLFrame* HTMLFrameTreeManager::FindNewLocalFrame() { diff --git a/components/html_viewer/html_viewer.cc b/components/html_viewer/html_viewer.cc index a454592..8d541d5 100644 --- a/components/html_viewer/html_viewer.cc +++ b/components/html_viewer/html_viewer.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/html_viewer.h" +#include <utility> + #include "components/html_viewer/content_handler_impl.h" #include "components/html_viewer/global_state.h" #include "mojo/application/public/cpp/application_connection.h" @@ -30,7 +32,7 @@ bool HTMLViewer::ConfigureIncomingConnection( void HTMLViewer::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::ContentHandler> request) { - new ContentHandlerImpl(global_state_.get(), app_, request.Pass()); + new ContentHandlerImpl(global_state_.get(), app_, std::move(request)); } } // namespace html_viewer diff --git a/components/html_viewer/html_widget.cc b/components/html_viewer/html_widget.cc index e13dc4c..21ac280 100644 --- a/components/html_viewer/html_widget.cc +++ b/components/html_viewer/html_widget.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/html_widget.h" #include <stdint.h> +#include <utility> #include "base/command_line.h" #include "components/html_viewer/blink_settings.h" @@ -39,7 +40,7 @@ void InitializeWebLayerTreeView(WebLayerTreeViewImpl* web_layer_tree_view, DCHECK(window); mus::mojom::GpuPtr gpu_service; app->ConnectToService("mojo:mus", &gpu_service); - web_layer_tree_view->Initialize(gpu_service.Pass(), window, widget); + web_layer_tree_view->Initialize(std::move(gpu_service), window, widget); } void UpdateWebViewSizeFromViewSize(mus::Window* window, diff --git a/components/html_viewer/ime_controller.cc b/components/html_viewer/ime_controller.cc index da6e7b1..d438284d 100644 --- a/components/html_viewer/ime_controller.cc +++ b/components/html_viewer/ime_controller.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/ime_controller.h" +#include <utility> + #include "components/html_viewer/blink_text_input_type_converters.h" #include "components/mus/public/cpp/window.h" #include "mojo/converters/blink/blink_input_events_type_converters.h" @@ -65,9 +67,9 @@ void ImeController::UpdateTextInputState(bool show_ime) { state->composition_start = new_info.compositionStart; state->composition_end = new_info.compositionEnd; if (show_ime) - window_->SetImeVisibility(true, state.Pass()); + window_->SetImeVisibility(true, std::move(state)); else - window_->SetTextInputState(state.Pass()); + window_->SetTextInputState(std::move(state)); } } diff --git a/components/html_viewer/layout_test_content_handler_impl.cc b/components/html_viewer/layout_test_content_handler_impl.cc index a66ce4b..163474c 100644 --- a/components/html_viewer/layout_test_content_handler_impl.cc +++ b/components/html_viewer/layout_test_content_handler_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/layout_test_content_handler_impl.h" +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "components/html_viewer/global_state.h" @@ -50,7 +52,7 @@ LayoutTestContentHandlerImpl::LayoutTestContentHandlerImpl( mojo::InterfaceRequest<mojo::ContentHandler> request, test_runner::WebTestInterfaces* test_interfaces, WebTestDelegateImpl* test_delegate) - : ContentHandlerImpl(global_state, app, request.Pass()), + : ContentHandlerImpl(global_state, app, std::move(request)), test_interfaces_(test_interfaces), test_delegate_(test_delegate), web_widget_proxy_(nullptr), @@ -69,9 +71,8 @@ void LayoutTestContentHandlerImpl::StartApplication( // HTMLDocumentApplicationDelegate deletes itself. HTMLDocumentApplicationDelegate* delegate = new HTMLDocumentApplicationDelegate( - request.Pass(), response.Pass(), global_state(), - app()->app_lifetime_helper()->CreateAppRefCount(), - destruct_callback); + std::move(request), std::move(response), global_state(), + app()->app_lifetime_helper()->CreateAppRefCount(), destruct_callback); delegate->set_html_factory(this); } diff --git a/components/html_viewer/layout_test_html_viewer.cc b/components/html_viewer/layout_test_html_viewer.cc index 459e301..d9a808e 100644 --- a/components/html_viewer/layout_test_html_viewer.cc +++ b/components/html_viewer/layout_test_html_viewer.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/layout_test_html_viewer.h" +#include <utility> + #include "components/html_viewer/global_state.h" #include "components/html_viewer/layout_test_content_handler_impl.h" #include "components/test_runner/web_test_interfaces.h" @@ -44,9 +46,8 @@ void LayoutTestHTMLViewer::TestFinished() { void LayoutTestHTMLViewer::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojo::ContentHandler> request) { - new LayoutTestContentHandlerImpl(global_state(), app(), request.Pass(), - test_interfaces_.get(), - &test_delegate_); + new LayoutTestContentHandlerImpl(global_state(), app(), std::move(request), + test_interfaces_.get(), &test_delegate_); } } // namespace html_viewer diff --git a/components/html_viewer/media_factory.cc b/components/html_viewer/media_factory.cc index 27002ec..613ac61 100644 --- a/components/html_viewer/media_factory.cc +++ b/components/html_viewer/media_factory.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/media_factory.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -112,9 +113,9 @@ blink::WebMediaPlayer* MediaFactory::CreateMediaPlayer( url_index_.reset(new media::UrlIndex(frame)); } - return new media::WebMediaPlayerImpl(frame, client, encrypted_client, - delegate, media_renderer_factory.Pass(), - GetCdmFactory(), url_index_, params); + return new media::WebMediaPlayerImpl( + frame, client, encrypted_client, delegate, + std::move(media_renderer_factory), GetCdmFactory(), url_index_, params); #endif // defined(OS_ANDROID) } @@ -132,8 +133,8 @@ media::interfaces::ServiceFactory* MediaFactory::GetMediaServiceFactory() { mojo::ServiceProviderPtr service_provider; mojo::URLRequestPtr request(mojo::URLRequest::New()); request->url = mojo::String::From("mojo:media"); - shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), - nullptr, nullptr, + shell_->ConnectToApplication(std::move(request), + GetProxy(&service_provider), nullptr, nullptr, base::Bind(&OnGotContentHandlerID)); mojo::ConnectToService(service_provider.get(), &media_service_factory_); } diff --git a/components/html_viewer/mock_web_blob_registry_impl.cc b/components/html_viewer/mock_web_blob_registry_impl.cc index b62eb9c..2ef3989 100644 --- a/components/html_viewer/mock_web_blob_registry_impl.cc +++ b/components/html_viewer/mock_web_blob_registry_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/mock_web_blob_registry_impl.h" +#include <utility> + #include "third_party/WebKit/public/platform/WebBlobData.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURL.h" @@ -34,7 +36,7 @@ void MockWebBlobRegistryImpl::registerBlobData(const WebString& uuid, data.itemAt(i, *item); items->push_back(item.release()); } - blob_data_items_map_.set(uuid_str, items.Pass()); + blob_data_items_map_.set(uuid_str, std::move(items)); } void MockWebBlobRegistryImpl::addBlobDataRef(const WebString& uuid) { diff --git a/components/html_viewer/replicated_frame_state.cc b/components/html_viewer/replicated_frame_state.cc index c514ad2..e5bdff3 100644 --- a/components/html_viewer/replicated_frame_state.cc +++ b/components/html_viewer/replicated_frame_state.cc @@ -36,16 +36,14 @@ void SetReplicatedFrameStateFromClientProperties( void ClientPropertiesFromReplicatedFrameState( const ReplicatedFrameState& state, mojo::Map<mojo::String, mojo::Array<uint8_t>>* properties) { - AddToClientPropertiesIfValid(kPropertyFrameName, - FrameNameToClientProperty(state.name).Pass(), - properties); AddToClientPropertiesIfValid( - kPropertyFrameTreeScope, - FrameTreeScopeToClientProperty(state.tree_scope).Pass(), properties); + kPropertyFrameName, FrameNameToClientProperty(state.name), properties); + AddToClientPropertiesIfValid(kPropertyFrameTreeScope, + FrameTreeScopeToClientProperty(state.tree_scope), + properties); AddToClientPropertiesIfValid( kPropertyFrameSandboxFlags, - FrameSandboxFlagsToClientProperty(state.sandbox_flags).Pass(), - properties); + FrameSandboxFlagsToClientProperty(state.sandbox_flags), properties); } } // namespace html_viewer diff --git a/components/html_viewer/stats_collection_controller.cc b/components/html_viewer/stats_collection_controller.cc index 24cdd39..9205027 100644 --- a/components/html_viewer/stats_collection_controller.cc +++ b/components/html_viewer/stats_collection_controller.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/stats_collection_controller.h" +#include <utility> + #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" @@ -89,12 +91,13 @@ tracing::StartupPerformanceDataCollectorPtr StatsCollectionController::Install( connection->ConnectToService(&collector_for_caller); gin::Handle<StatsCollectionController> controller = gin::CreateHandle( - isolate, new StatsCollectionController(collector_for_controller.Pass())); + isolate, + new StatsCollectionController(std::move(collector_for_controller))); DCHECK(!controller.IsEmpty()); v8::Local<v8::Object> global = context->Global(); global->Set(gin::StringToV8(isolate, "statsCollectionController"), controller.ToV8()); - return collector_for_caller.Pass(); + return collector_for_caller; } // static @@ -109,12 +112,12 @@ StatsCollectionController::ConnectToDataCollector(mojo::ApplicationImpl* app) { tracing::StartupPerformanceDataCollectorPtr collector; app->ConnectToService("mojo:tracing", &collector); - return collector.Pass(); + return collector; } StatsCollectionController::StatsCollectionController( tracing::StartupPerformanceDataCollectorPtr collector) - : startup_performance_data_collector_(collector.Pass()) {} + : startup_performance_data_collector_(std::move(collector)) {} StatsCollectionController::~StatsCollectionController() {} diff --git a/components/html_viewer/test_html_viewer_impl.cc b/components/html_viewer/test_html_viewer_impl.cc index a0af8f7..010e56d 100644 --- a/components/html_viewer/test_html_viewer_impl.cc +++ b/components/html_viewer/test_html_viewer_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/test_html_viewer_impl.h" +#include <utility> + #include "base/json/json_writer.h" #include "base/macros.h" #include "base/stl_util.h" @@ -65,7 +67,7 @@ class TestHTMLViewerImpl::ExecutionCallbackImpl TestHTMLViewerImpl::TestHTMLViewerImpl( blink::WebLocalFrame* web_frame, mojo::InterfaceRequest<TestHTMLViewer> request) - : web_frame_(web_frame), binding_(this, request.Pass()) {} + : web_frame_(web_frame), binding_(this, std::move(request)) {} TestHTMLViewerImpl::~TestHTMLViewerImpl() { STLDeleteElements(&callbacks_); diff --git a/components/html_viewer/web_clipboard_impl.cc b/components/html_viewer/web_clipboard_impl.cc index cf04b7e..33053cf 100644 --- a/components/html_viewer/web_clipboard_impl.cc +++ b/components/html_viewer/web_clipboard_impl.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/web_clipboard_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "components/html_viewer/blink_basic_type_converters.h" @@ -57,8 +58,7 @@ const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste"; } // namespace WebClipboardImpl::WebClipboardImpl(mojo::ClipboardPtr clipboard) - : clipboard_(clipboard.Pass()) { -} + : clipboard_(std::move(clipboard)) {} WebClipboardImpl::~WebClipboardImpl() { } @@ -176,7 +176,7 @@ void WebClipboardImpl::writePlainText(const blink::WebString& plain_text) { Map<String, Array<uint8_t>> data; data[Clipboard::MIME_TYPE_TEXT] = Array<uint8_t>::From(plain_text); - clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, data.Pass()); + clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, std::move(data)); } void WebClipboardImpl::writeHTML(const blink::WebString& html_text, @@ -191,7 +191,7 @@ void WebClipboardImpl::writeHTML(const blink::WebString& html_text, if (writeSmartPaste) data[kMimeTypeWebkitSmartPaste] = Array<uint8_t>::From(blink::WebString()); - clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, data.Pass()); + clipboard_->WriteClipboardData(Clipboard::TYPE_COPY_PASTE, std::move(data)); } Clipboard::Type WebClipboardImpl::ConvertBufferType(Buffer buffer) { diff --git a/components/html_viewer/web_cookie_jar_impl.cc b/components/html_viewer/web_cookie_jar_impl.cc index c59bfd2..ec04b6c 100644 --- a/components/html_viewer/web_cookie_jar_impl.cc +++ b/components/html_viewer/web_cookie_jar_impl.cc @@ -4,6 +4,8 @@ #include "components/html_viewer/web_cookie_jar_impl.h" +#include <utility> + #include "base/bind.h" #include "third_party/WebKit/public/platform/WebURL.h" @@ -23,8 +25,7 @@ void CopyString(String* output, const String& input) { } // namespace WebCookieJarImpl::WebCookieJarImpl(mojo::CookieStorePtr store) - : store_(store.Pass()) { -} + : store_(std::move(store)) {} WebCookieJarImpl::~WebCookieJarImpl() { } diff --git a/components/html_viewer/web_layer_tree_view_impl.cc b/components/html_viewer/web_layer_tree_view_impl.cc index c223b4e..90e8103 100644 --- a/components/html_viewer/web_layer_tree_view_impl.cc +++ b/components/html_viewer/web_layer_tree_view_impl.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/web_layer_tree_view_impl.h" #include <stddef.h> +#include <utility> #include "base/thread_task_runner_handle.h" #include "cc/blink/web_layer_impl.h" @@ -122,7 +123,7 @@ void WebLayerTreeViewImpl::ApplyViewportDeltas( void WebLayerTreeViewImpl::RequestNewOutputSurface() { if (output_surface_.get()) - layer_tree_host_->SetOutputSurface(output_surface_.Pass()); + layer_tree_host_->SetOutputSurface(std::move(output_surface_)); } void WebLayerTreeViewImpl::DidFailToInitializeOutputSurface() { diff --git a/components/html_viewer/web_socket_handle_impl.cc b/components/html_viewer/web_socket_handle_impl.cc index 155dad2..f311aa8 100644 --- a/components/html_viewer/web_socket_handle_impl.cc +++ b/components/html_viewer/web_socket_handle_impl.cc @@ -4,6 +4,7 @@ #include "components/html_viewer/web_socket_handle_impl.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -76,7 +77,7 @@ class WebSocketClientImpl : public mojo::WebSocketClient { WebSocketClientImpl(WebSocketHandleImpl* handle, blink::WebSocketHandleClient* client, mojo::InterfaceRequest<mojo::WebSocketClient> request) - : handle_(handle), client_(client), binding_(this, request.Pass()) {} + : handle_(handle), client_(client), binding_(this, std::move(request)) {} ~WebSocketClientImpl() override {} private: @@ -86,7 +87,7 @@ class WebSocketClientImpl : public mojo::WebSocketClient { mojo::ScopedDataPipeConsumerHandle receive_stream) override { blink::WebSocketHandleClient* client = client_; WebSocketHandleImpl* handle = handle_; - receive_stream_ = receive_stream.Pass(); + receive_stream_ = std::move(receive_stream); read_queue_.reset(new WebSocketReadQueue(receive_stream_.get())); client->didConnect(handle, selected_subprotocol.To<WebString>(), @@ -167,19 +168,19 @@ void WebSocketHandleImpl::connect(const WebURL& url, // |client_|? mojo::WebSocketClientPtr client_ptr; mojo::MessagePipe pipe; - client_ptr.Bind( - mojo::InterfacePtrInfo<mojo::WebSocketClient>(pipe.handle0.Pass(), 0u)); + client_ptr.Bind(mojo::InterfacePtrInfo<mojo::WebSocketClient>( + std::move(pipe.handle0), 0u)); mojo::InterfaceRequest<mojo::WebSocketClient> request; - request.Bind(pipe.handle1.Pass()); - client_.reset(new WebSocketClientImpl(this, client, request.Pass())); + request.Bind(std::move(pipe.handle1)); + client_.reset(new WebSocketClientImpl(this, client, std::move(request))); mojo::DataPipe data_pipe; - send_stream_ = data_pipe.producer_handle.Pass(); + send_stream_ = std::move(data_pipe.producer_handle); write_queue_.reset(new mojo::WebSocketWriteQueue(send_stream_.get())); - web_socket_->Connect(url.string().utf8(), - mojo::Array<String>::From(protocols), - origin.toString().utf8(), - data_pipe.consumer_handle.Pass(), client_ptr.Pass()); + web_socket_->Connect( + url.string().utf8(), mojo::Array<String>::From(protocols), + origin.toString().utf8(), std::move(data_pipe.consumer_handle), + std::move(client_ptr)); } void WebSocketHandleImpl::send(bool fin, diff --git a/components/html_viewer/web_test_delegate_impl.cc b/components/html_viewer/web_test_delegate_impl.cc index 0be84de..3111c09 100644 --- a/components/html_viewer/web_test_delegate_impl.cc +++ b/components/html_viewer/web_test_delegate_impl.cc @@ -5,6 +5,7 @@ #include "components/html_viewer/web_test_delegate_impl.h" #include <iostream> +#include <utility> #include "base/time/time.h" #include "cc/layers/texture_layer.h" @@ -26,7 +27,7 @@ namespace { class InvokeTaskHelper : public blink::WebTaskRunner::Task { public: InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task) - : task_(task.Pass()) {} + : task_(std::move(task)) {} // WebThread::Task implementation: void run() override { task_->run(); } diff --git a/components/html_viewer/web_url_loader_impl.cc b/components/html_viewer/web_url_loader_impl.cc index ac6bd85..f54e227 100644 --- a/components/html_viewer/web_url_loader_impl.cc +++ b/components/html_viewer/web_url_loader_impl.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -97,9 +98,9 @@ void WebURLLoaderImpl::loadSynchronously( mojo::URLRequestPtr url_request = mojo::URLRequest::From(request); url_request->auto_follow_redirects = true; URLResponsePtr url_response; - url_loader_->Start(url_request.Pass(), + url_loader_->Start(std::move(url_request), [&url_response](URLResponsePtr url_response_result) { - url_response = url_response_result.Pass(); + url_response = std::move(url_response_result); }); url_loader_.WaitForIncomingResponse(); if (url_response->error) { @@ -111,7 +112,7 @@ void WebURLLoaderImpl::loadSynchronously( response = ToWebURLResponse(url_response); std::string body; - mojo::common::BlockingCopyToString(url_response->body.Pass(), &body); + mojo::common::BlockingCopyToString(std::move(url_response->body), &body); data.assign(body.data(), body.length()); } @@ -148,7 +149,7 @@ void WebURLLoaderImpl::loadAsynchronously(const blink::WebURLRequest& request, } } - url_loader_->Start(url_request.Pass(), + url_loader_->Start(std::move(url_request), base::Bind(&WebURLLoaderImpl::OnReceivedResponse, weak_factory_.GetWeakPtr(), request)); } @@ -179,9 +180,9 @@ void WebURLLoaderImpl::OnReceivedResponse(const blink::WebURLRequest& request, url_ = GURL(url_response->url); if (url_response->error) { - OnReceivedError(url_response.Pass()); + OnReceivedError(std::move(url_response)); } else if (url_response->redirect_url) { - OnReceivedRedirect(request, url_response.Pass()); + OnReceivedRedirect(request, std::move(url_response)); } else { base::WeakPtr<WebURLLoaderImpl> self(weak_factory_.GetWeakPtr()); client_->didReceiveResponse(this, ToWebURLResponse(url_response)); @@ -191,7 +192,7 @@ void WebURLLoaderImpl::OnReceivedResponse(const blink::WebURLRequest& request, return; // Start streaming data - response_body_stream_ = url_response->body.Pass(); + response_body_stream_ = std::move(url_response->body); ReadMore(); } } |