diff --git a/DEPS b/DEPS index cb9bb61..9595b633 100644 --- a/DEPS +++ b/DEPS
@@ -39,7 +39,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'cc3a22b369e1a60fa2acf2987f2934baf7c4b198', + 'skia_revision': '875e13ca0990e32da9db639743a913efe77f7e89', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -184,7 +184,7 @@ Var('chromium_git') + '/external/bidichecker/lib.git' + '@' + '97f2aa645b74c28c57eca56992235c79850fa9e0', 'src/third_party/webgl/src': - Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '0d2d36cf7e77343211574478fb6a072ffb9e36af', + Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '2c4f810d8588d3bdcc7081a811b74ed7abc6b467', 'src/third_party/webdriver/pylib': Var('chromium_git') + '/external/selenium/py.git' + '@' + '5fd78261a75fe08d27ca4835fb6c5ce4b42275bd',
diff --git a/chrome/renderer/chrome_render_thread_observer.cc b/chrome/renderer/chrome_render_thread_observer.cc index 448b7b60..60b4190b 100644 --- a/chrome/renderer/chrome_render_thread_observer.cc +++ b/chrome/renderer/chrome_render_thread_observer.cc
@@ -170,8 +170,7 @@ workers_to_go_ = 0; } - void GetUsageData(const mojo::Callback<void(mojom::ResourceUsageDataPtr)>& - callback) override { + void GetUsageData(const GetUsageDataCallback& callback) override { DCHECK(callback_.is_null()); weak_factory_.InvalidateWeakPtrs(); usage_data_ = mojom::ResourceUsageData::New(); @@ -215,7 +214,7 @@ } mojom::ResourceUsageDataPtr usage_data_; - mojo::Callback<void(mojom::ResourceUsageDataPtr)> callback_; + GetUsageDataCallback callback_; int workers_to_go_; mojo::StrongBinding<mojom::ResourceUsageReporter> binding_; base::WeakPtr<ChromeRenderThreadObserver> observer_;
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index ad0929e..3c260e1 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc
@@ -83,8 +83,7 @@ ~ResourceUsageReporterImpl() override {} private: - void GetUsageData(const mojo::Callback<void(mojom::ResourceUsageDataPtr)>& - callback) override { + void GetUsageData(const GetUsageDataCallback& callback) override { mojom::ResourceUsageDataPtr data = mojom::ResourceUsageData::New(); size_t total_heap_size = net::ProxyResolverV8::GetTotalHeapSize(); if (total_heap_size) {
diff --git a/chrome/utility/image_decoder_impl.cc b/chrome/utility/image_decoder_impl.cc index 4215e6e9..1b78b7f 100644 --- a/chrome/utility/image_decoder_impl.cc +++ b/chrome/utility/image_decoder_impl.cc
@@ -41,7 +41,7 @@ mojo::Array<uint8_t> encoded_data, mojom::ImageCodec codec, bool shrink_to_fit, - const mojo::Callback<void(const SkBitmap&)>& callback) { + const DecodeImageCallback& callback) { if (encoded_data.size() == 0) { callback.Run(SkBitmap()); return;
diff --git a/chrome/utility/image_decoder_impl.h b/chrome/utility/image_decoder_impl.h index d6226f6..73f05f1 100644 --- a/chrome/utility/image_decoder_impl.h +++ b/chrome/utility/image_decoder_impl.h
@@ -21,7 +21,7 @@ mojo::Array<uint8_t> encoded_data, mojom::ImageCodec codec, bool shrink_to_fit, - const mojo::Callback<void(const SkBitmap&)>& callback) override; + const DecodeImageCallback& callback) override; private: int64_t max_message_size_;
diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.cc b/components/arc/bluetooth/arc_bluetooth_bridge.cc index 1d0a6c5..50d5f96 100644 --- a/components/arc/bluetooth/arc_bluetooth_bridge.cc +++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -389,18 +389,18 @@ } void ArcBluetoothBridge::OnPoweredOn( - const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const { + const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const { callback.Run(mojom::BluetoothAdapterState::ON); SendCachedPairedDevices(); } void ArcBluetoothBridge::OnPoweredOff( - const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const { + const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const { callback.Run(mojom::BluetoothAdapterState::OFF); } void ArcBluetoothBridge::OnPoweredError( - const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const { + const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const { LOG(WARNING) << "failed to change power state"; callback.Run(bluetooth_adapter_->IsPowered()
diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.h b/components/arc/bluetooth/arc_bluetooth_bridge.h index 81b120b..915d560 100644 --- a/components/arc/bluetooth/arc_bluetooth_bridge.h +++ b/components/arc/bluetooth/arc_bluetooth_bridge.h
@@ -12,6 +12,7 @@ #include <string> #include <vector> +#include "base/callback.h" #include "components/arc/arc_bridge_service.h" #include "components/arc/arc_service.h" #include "components/arc/common/bluetooth.mojom.h" @@ -190,11 +191,11 @@ // Chrome observer callbacks void OnPoweredOn( - const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; + const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const; void OnPoweredOff( - const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; + const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const; void OnPoweredError( - const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const; + const base::Callback<void(mojom::BluetoothAdapterState)>& callback) const; void OnDiscoveryStarted( std::unique_ptr<device::BluetoothDiscoverySession> session); void OnDiscoveryStopped(); @@ -228,14 +229,14 @@ const StopLEListenCallback& callback, device::BluetoothAdvertisement::ErrorCode error_code); - using GattReadCallback = mojo::Callback<void(mojom::BluetoothGattValuePtr)>; + using GattReadCallback = base::Callback<void(mojom::BluetoothGattValuePtr)>; void OnGattReadDone(const GattReadCallback& callback, const std::vector<uint8_t>& result) const; void OnGattReadError( const GattReadCallback& callback, device::BluetoothGattService::GattErrorCode error_code) const; - using GattWriteCallback = mojo::Callback<void(mojom::BluetoothGattStatus)>; + using GattWriteCallback = base::Callback<void(mojom::BluetoothGattStatus)>; void OnGattWriteDone(const GattWriteCallback& callback) const; void OnGattWriteError( const GattWriteCallback& callback,
diff --git a/components/arc/obb_mounter/arc_obb_mounter_bridge.cc b/components/arc/obb_mounter/arc_obb_mounter_bridge.cc index a28572c..b9f3356 100644 --- a/components/arc/obb_mounter/arc_obb_mounter_bridge.cc +++ b/components/arc/obb_mounter/arc_obb_mounter_bridge.cc
@@ -14,8 +14,8 @@ namespace { // Used to convert mojo Callback to VoidDBusMethodCallback. -void RunMojoCallback(const mojo::Callback<void(bool)>& callback, - chromeos::DBusMethodCallStatus result) { +void RunObbCallback(const base::Callback<void(bool)>& callback, + chromeos::DBusMethodCallStatus result) { callback.Run(result == chromeos::DBUS_METHOD_CALL_SUCCESS); } @@ -43,13 +43,13 @@ const MountObbCallback& callback) { chromeos::DBusThreadManager::Get()->GetArcObbMounterClient()->MountObb( obb_file.get(), target_path.get(), owner_gid, - base::Bind(&RunMojoCallback, callback)); + base::Bind(&RunObbCallback, callback)); } void ArcObbMounterBridge::UnmountObb(const mojo::String& target_path, const UnmountObbCallback& callback) { chromeos::DBusThreadManager::Get()->GetArcObbMounterClient()->UnmountObb( - target_path.get(), base::Bind(&RunMojoCallback, callback)); + target_path.get(), base::Bind(&RunObbCallback, callback)); } } // namespace arc
diff --git a/components/bitmap_uploader/bitmap_uploader.cc b/components/bitmap_uploader/bitmap_uploader.cc index a6c7899..61e2266b 100644 --- a/components/bitmap_uploader/bitmap_uploader.cc +++ b/components/bitmap_uploader/bitmap_uploader.cc
@@ -172,7 +172,7 @@ frame->passes.push_back(std::move(pass)); // TODO(rjkroege, fsamuel): We should throttle frames. - surface_->SubmitCompositorFrame(std::move(frame), mojo::Closure()); + surface_->SubmitCompositorFrame(std::move(frame), base::Closure()); } uint32_t BitmapUploader::BindTextureForSize(const gfx::Size& size) {
diff --git a/components/filesystem/directory_impl.h b/components/filesystem/directory_impl.h index 9d4e212..5b2ed5eb0 100644 --- a/components/filesystem/directory_impl.h +++ b/components/filesystem/directory_impl.h
@@ -31,7 +31,7 @@ scoped_refptr<LockTable> lock_table); ~DirectoryImpl() override; - void set_connection_error_handler(const mojo::Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { binding_.set_connection_error_handler(error_handler); }
diff --git a/components/font_service/BUILD.gn b/components/font_service/BUILD.gn index 59dd6e808..c836675 100644 --- a/components/font_service/BUILD.gn +++ b/components/font_service/BUILD.gn
@@ -34,9 +34,7 @@ deps = [ ":lib", "//base", - "//mojo/common", - "//mojo/common:common_base", - "//mojo/public/cpp/bindings:callback", + "//mojo/public/c/system", "//services/shell/public/cpp", ]
diff --git a/components/mus/clipboard/BUILD.gn b/components/mus/clipboard/BUILD.gn index f6e26613..98f5196 100644 --- a/components/mus/clipboard/BUILD.gn +++ b/components/mus/clipboard/BUILD.gn
@@ -17,7 +17,6 @@ "//components/mus/public/interfaces", "//mojo/common", "//mojo/public/cpp/bindings", - "//mojo/public/cpp/bindings:callback", "//services/shell/public/cpp", "//services/tracing/public/cpp", ]
diff --git a/components/mus/clipboard/clipboard_impl.cc b/components/mus/clipboard/clipboard_impl.cc index 221359f..a82d95e8 100644 --- a/components/mus/clipboard/clipboard_impl.cc +++ b/components/mus/clipboard/clipboard_impl.cc
@@ -10,7 +10,6 @@ #include "base/macros.h" #include "mojo/common/common_type_converters.h" #include "mojo/public/cpp/bindings/array.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/string.h" using mojo::Array;
diff --git a/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc b/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc index 942f10f..f4aad23 100644 --- a/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc +++ b/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc
@@ -15,7 +15,7 @@ namespace { void CallCallback( - const mojo::Callback<void(mojom::CompositorFrameDrawStatus)>& callback, + const mojom::CompositorFrameSink::SubmitCompositorFrameCallback& callback, cc::SurfaceDrawStatus draw_status) { callback.Run(static_cast<mojom::CompositorFrameDrawStatus>(draw_status)); }
diff --git a/components/mus/public/cpp/lib/window_surface.cc b/components/mus/public/cpp/lib/window_surface.cc index 93bbc78..b8496114 100644 --- a/components/mus/public/cpp/lib/window_surface.cc +++ b/components/mus/public/cpp/lib/window_surface.cc
@@ -35,7 +35,7 @@ } void WindowSurface::SubmitCompositorFrame(mojom::CompositorFramePtr frame, - const mojo::Closure& callback) { + const base::Closure& callback) { DCHECK(thread_checker_); DCHECK(thread_checker_->CalledOnValidThread()); if (!surface_)
diff --git a/components/mus/public/cpp/window_surface.h b/components/mus/public/cpp/window_surface.h index 9431e0e4..3a9bddfd 100644 --- a/components/mus/public/cpp/window_surface.h +++ b/components/mus/public/cpp/window_surface.h
@@ -7,6 +7,7 @@ #include <memory> +#include "base/callback.h" #include "base/macros.h" #include "base/observer_list.h" #include "base/threading/thread_checker.h" @@ -35,7 +36,7 @@ void BindToThread(); void SubmitCompositorFrame(mojom::CompositorFramePtr frame, - const mojo::Closure& callback); + const base::Closure& callback); void set_client(WindowSurfaceClient* client) { client_ = client; }
diff --git a/components/mus/ws/BUILD.gn b/components/mus/ws/BUILD.gn index e9313537..3359ee1 100644 --- a/components/mus/ws/BUILD.gn +++ b/components/mus/ws/BUILD.gn
@@ -101,7 +101,7 @@ "//components/mus/public/interfaces", "//components/mus/surfaces", "//mojo/common:common_base", - "//mojo/public/cpp/bindings:callback", + "//mojo/public/cpp/bindings", "//services/shell/public/cpp", "//services/shell/public/interfaces", "//services/tracing/public/cpp",
diff --git a/components/mus/ws/platform_display.h b/components/mus/ws/platform_display.h index 32e82cb0..e733e25 100644 --- a/components/mus/ws/platform_display.h +++ b/components/mus/ws/platform_display.h
@@ -21,7 +21,6 @@ #include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/ws/platform_display_delegate.h" #include "components/mus/ws/platform_display_init_params.h" -#include "mojo/public/cpp/bindings/callback.h" #include "ui/gfx/geometry/rect.h" #include "ui/platform_window/platform_window_delegate.h"
diff --git a/components/mus/ws/server_window_surface.cc b/components/mus/ws/server_window_surface.cc index 97542d5..28d6f4e 100644 --- a/components/mus/ws/server_window_surface.cc +++ b/components/mus/ws/server_window_surface.cc
@@ -4,6 +4,7 @@ #include "components/mus/ws/server_window_surface.h" +#include "base/callback.h" #include "cc/output/compositor_frame.h" #include "cc/quads/shared_quad_state.h" #include "cc/quads/surface_draw_quad.h" @@ -17,7 +18,7 @@ namespace ws { namespace { -void CallCallback(const mojo::Closure& callback, cc::SurfaceDrawStatus status) { +void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) { callback.Run(); }
diff --git a/components/mus/ws/window_tree.cc b/components/mus/ws/window_tree.cc index fa53c986..285faec4 100644 --- a/components/mus/ws/window_tree.cc +++ b/components/mus/ws/window_tree.cc
@@ -31,7 +31,6 @@ #include "ui/platform_window/text_input_state.h" using mojo::Array; -using mojo::Callback; using mojo::InterfaceRequest; using mojo::String; @@ -1120,7 +1119,7 @@ void WindowTree::GetWindowTree( Id window_id, - const Callback<void(Array<mojom::WindowDataPtr>)>& callback) { + const base::Callback<void(Array<mojom::WindowDataPtr>)>& callback) { std::vector<const ServerWindow*> windows( GetWindowTree(ClientWindowId(window_id))); callback.Run(WindowsToWindowDatas(windows));
diff --git a/components/mus/ws/window_tree.h b/components/mus/ws/window_tree.h index 4a03beb..608173c 100644 --- a/components/mus/ws/window_tree.h +++ b/components/mus/ws/window_tree.h
@@ -14,6 +14,7 @@ #include <string> #include <vector> +#include "base/callback.h" #include "base/containers/hash_tables.h" #include "base/macros.h" #include "cc/ipc/surface_id.mojom.h" @@ -344,7 +345,7 @@ mojom::OrderDirection direction) override; void GetWindowTree( Id window_id, - const mojo::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) + const base::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback) override; void SetCapture(uint32_t change_id, Id window_id) override; void ReleaseCapture(uint32_t change_id, Id window_id) override;
diff --git a/components/mus/ws/window_tree_client_unittest.cc b/components/mus/ws/window_tree_client_unittest.cc index 5ec93ae..e4d77a5 100644 --- a/components/mus/ws/window_tree_client_unittest.cc +++ b/components/mus/ws/window_tree_client_unittest.cc
@@ -19,7 +19,6 @@ #include "services/shell/public/cpp/shell_test.h" using mojo::Array; -using mojo::Callback; using shell::Connection; using mojo::InterfaceRequest; using shell::ShellClient;
diff --git a/content/browser/battery_status/battery_monitor_integration_browsertest.cc b/content/browser/battery_status/battery_monitor_integration_browsertest.cc index 92d9340..5115c3f 100644 --- a/content/browser/battery_status/battery_monitor_integration_browsertest.cc +++ b/content/browser/battery_status/battery_monitor_integration_browsertest.cc
@@ -54,13 +54,11 @@ } private: - typedef mojo::Callback<void(device::BatteryStatusPtr)> BatteryStatusCallback; - FakeBatteryMonitor(mojo::InterfaceRequest<BatteryMonitor> request) : binding_(this, std::move(request)) {} ~FakeBatteryMonitor() override {} - void QueryNextStatus(const BatteryStatusCallback& callback) override { + void QueryNextStatus(const QueryNextStatusCallback& callback) override { // We don't expect overlapped calls to QueryNextStatus. DCHECK(callback_.is_null()); @@ -84,7 +82,7 @@ std::unique_ptr<BatteryUpdateSubscription> subscription_; mojo::StrongBinding<BatteryMonitor> binding_; - BatteryStatusCallback callback_; + QueryNextStatusCallback callback_; }; // Overrides the default service implementation with the test implementation
diff --git a/content/browser/geolocation/geolocation_service_impl.cc b/content/browser/geolocation/geolocation_service_impl.cc index 8aa6aef..e05dda47 100644 --- a/content/browser/geolocation/geolocation_service_impl.cc +++ b/content/browser/geolocation/geolocation_service_impl.cc
@@ -122,7 +122,7 @@ } void GeolocationServiceImpl::QueryNextPosition( - const PositionCallback& callback) { + const QueryNextPositionCallback& callback) { if (!position_callback_.is_null()) { DVLOG(1) << "Overlapped call to QueryNextPosition!"; OnConnectionError(); // Simulate a connection error.
diff --git a/content/browser/geolocation/geolocation_service_impl.h b/content/browser/geolocation/geolocation_service_impl.h index df37f88..9265db3 100644 --- a/content/browser/geolocation/geolocation_service_impl.h +++ b/content/browser/geolocation/geolocation_service_impl.h
@@ -41,11 +41,9 @@ void ClearOverride(); private: - typedef mojo::Callback<void(blink::mojom::GeopositionPtr)> PositionCallback; - // blink::mojom::GeolocationService: void SetHighAccuracy(bool high_accuracy) override; - void QueryNextPosition(const PositionCallback& callback) override; + void QueryNextPosition(const QueryNextPositionCallback& callback) override; void OnConnectionError(); @@ -64,7 +62,7 @@ base::Closure update_callback_; // The callback passed to QueryNextPosition. - PositionCallback position_callback_; + QueryNextPositionCallback position_callback_; // Valid iff SetOverride() has been called and ClearOverride() has not // subsequently been called.
diff --git a/content/browser/media/capture/image_capture_impl.cc b/content/browser/media/capture/image_capture_impl.cc index b0c0db2..0a250f7 100644 --- a/content/browser/media/capture/image_capture_impl.cc +++ b/content/browser/media/capture/image_capture_impl.cc
@@ -17,12 +17,6 @@ namespace { -template<typename R, typename... Args> -void RunMojoCallback(const mojo::Callback<R(Args...)>& callback, Args... args) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - callback.Run(std::forward<Args>(args)...); -} - void RunFailedGetCapabilitiesCallback( const ImageCaptureImpl::GetCapabilitiesCallback& cb) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -38,8 +32,7 @@ mojo::Array<uint8_t> data) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&RunMojoCallback<void, mojo::String, mojo::Array<uint8_t>>, - callback, mime_type, base::Passed(std::move(data)))); + base::Bind(callback, mime_type, base::Passed(std::move(data)))); } void RunFailedTakePhotoCallback(const ImageCaptureImpl::TakePhotoCallback& cb) {
diff --git a/content/browser/permissions/permission_service_impl.cc b/content/browser/permissions/permission_service_impl.cc index 757c293..39daa643 100644 --- a/content/browser/permissions/permission_service_impl.cc +++ b/content/browser/permissions/permission_service_impl.cc
@@ -50,7 +50,7 @@ // This function allows the usage of the the multiple request map // with single requests. void PermissionRequestResponseCallbackWrapper( - const mojo::Callback<void(PermissionStatus)>& callback, + const base::Callback<void(PermissionStatus)>& callback, mojo::Array<PermissionStatus> vector) { DCHECK_EQ(vector.size(), 1ul); callback.Run(vector[0]); @@ -59,7 +59,7 @@ } // anonymous namespace PermissionServiceImpl::PendingRequest::PendingRequest( - const PermissionsStatusCallback& callback, + const RequestPermissionsCallback& callback, int request_count) : callback(callback), request_count(request_count) { @@ -162,7 +162,7 @@ mojo::Array<PermissionName> permissions, const mojo::String& origin, bool user_gesture, - const PermissionsStatusCallback& callback) { + const RequestPermissionsCallback& callback) { if (permissions.is_null()) { callback.Run(mojo::Array<PermissionStatus>()); return; @@ -215,7 +215,7 @@ int pending_request_id, const std::vector<PermissionStatus>& result) { PendingRequest* request = pending_requests_.Lookup(pending_request_id); - PermissionsStatusCallback callback(request->callback); + RequestPermissionsCallback callback(request->callback); request->callback.Reset(); pending_requests_.Remove(pending_request_id); callback.Run(mojo::Array<PermissionStatus>::From(result));
diff --git a/content/browser/permissions/permission_service_impl.h b/content/browser/permissions/permission_service_impl.h index a7daafe..208c058 100644 --- a/content/browser/permissions/permission_service_impl.h +++ b/content/browser/permissions/permission_service_impl.h
@@ -5,6 +5,7 @@ #ifndef CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_IMPL_H_ #define CONTENT_BROWSER_PERMISSIONS_PERMISSION_SERVICE_IMPL_H_ +#include "base/callback.h" #include "base/id_map.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -41,18 +42,16 @@ private: using PermissionStatusCallback = - mojo::Callback<void(blink::mojom::PermissionStatus)>; - using PermissionsStatusCallback = - mojo::Callback<void(mojo::Array<blink::mojom::PermissionStatus>)>; + base::Callback<void(blink::mojom::PermissionStatus)>; struct PendingRequest { - PendingRequest(const PermissionsStatusCallback& callback, + PendingRequest(const RequestPermissionsCallback& callback, int request_count); ~PendingRequest(); // Request ID received from the PermissionManager. int id; - PermissionsStatusCallback callback; + RequestPermissionsCallback callback; int request_count; }; using RequestsMap = IDMap<PendingRequest, IDMapOwnPointer>; @@ -81,7 +80,7 @@ void RequestPermissions(mojo::Array<blink::mojom::PermissionName> permissions, const mojo::String& origin, bool user_gesture, - const PermissionsStatusCallback& callback) override; + const RequestPermissionsCallback& callback) override; void RevokePermission(blink::mojom::PermissionName permission, const mojo::String& origin, const PermissionStatusCallback& callback) override;
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc index 23734a6..17ec835 100644 --- a/content/browser/presentation/presentation_service_impl.cc +++ b/content/browser/presentation/presentation_service_impl.cc
@@ -112,8 +112,8 @@ return output; } -void InvokeNewSessionMojoCallbackWithError( - const NewSessionMojoCallback& callback) { +void InvokeNewSessionCallbackWithError( + const PresentationServiceImpl::NewSessionCallback& callback) { callback.Run(blink::mojom::PresentationSessionInfoPtr(), blink::mojom::PresentationError::From(PresentationError( PRESENTATION_ERROR_UNKNOWN, "Internal error"))); @@ -218,9 +218,8 @@ screen_availability_listeners_.erase(listener_it); } -void PresentationServiceImpl::StartSession( - const mojo::String& presentation_url, - const NewSessionMojoCallback& callback) { +void PresentationServiceImpl::StartSession(const mojo::String& presentation_url, + const NewSessionCallback& callback) { DVLOG(2) << "StartSession"; if (!delegate_) { callback.Run( @@ -233,12 +232,12 @@ // There is a StartSession request in progress. To avoid queueing up // requests, the incoming request is rejected. if (start_session_request_id_ != kInvalidRequestSessionId) { - InvokeNewSessionMojoCallbackWithError(callback); + InvokeNewSessionCallbackWithError(callback); return; } start_session_request_id_ = GetNextRequestSessionId(); - pending_start_session_cb_.reset(new NewSessionMojoCallbackWrapper(callback)); + pending_start_session_cb_.reset(new NewSessionCallbackWrapper(callback)); delegate_->StartSession( render_process_id_, render_frame_id_, presentation_url, base::Bind(&PresentationServiceImpl::OnStartSessionSucceeded, @@ -250,7 +249,7 @@ void PresentationServiceImpl::JoinSession( const mojo::String& presentation_url, const mojo::String& presentation_id, - const NewSessionMojoCallback& callback) { + const NewSessionCallback& callback) { DVLOG(2) << "JoinSession"; if (!delegate_) { callback.Run(blink::mojom::PresentationSessionInfoPtr(), @@ -262,7 +261,7 @@ int request_session_id = RegisterJoinSessionCallback(callback); if (request_session_id == kInvalidRequestSessionId) { - InvokeNewSessionMojoCallbackWithError(callback); + InvokeNewSessionCallbackWithError(callback); return; } delegate_->JoinSession( @@ -277,13 +276,13 @@ } int PresentationServiceImpl::RegisterJoinSessionCallback( - const NewSessionMojoCallback& callback) { + const NewSessionCallback& callback) { if (pending_join_session_cbs_.size() >= kMaxNumQueuedSessionRequests) return kInvalidRequestSessionId; int request_id = GetNextRequestSessionId(); pending_join_session_cbs_[request_id].reset( - new NewSessionMojoCallbackWrapper(callback)); + new NewSessionCallbackWrapper(callback)); return request_id; } @@ -378,7 +377,7 @@ void PresentationServiceImpl::SendSessionMessage( blink::mojom::PresentationSessionInfoPtr session, blink::mojom::SessionMessagePtr session_message, - const SendMessageMojoCallback& callback) { + const SendSessionMessageCallback& callback) { DVLOG(2) << "SendSessionMessage"; DCHECK(!session_message.is_null()); // send_message_callback_ should be null by now, otherwise resetting of @@ -388,7 +387,7 @@ return; } - send_message_callback_.reset(new SendMessageMojoCallback(callback)); + send_message_callback_.reset(new SendSessionMessageCallback(callback)); delegate_->SendMessage( render_process_id_, render_frame_id_, session.To<PresentationSessionInfo>(), @@ -590,18 +589,18 @@ service_->client_->OnScreenAvailabilityNotSupported(availability_url_); } -PresentationServiceImpl::NewSessionMojoCallbackWrapper -::NewSessionMojoCallbackWrapper(const NewSessionMojoCallback& callback) +PresentationServiceImpl::NewSessionCallbackWrapper +::NewSessionCallbackWrapper(const NewSessionCallback& callback) : callback_(callback) { } -PresentationServiceImpl::NewSessionMojoCallbackWrapper -::~NewSessionMojoCallbackWrapper() { +PresentationServiceImpl::NewSessionCallbackWrapper +::~NewSessionCallbackWrapper() { if (!callback_.is_null()) - InvokeNewSessionMojoCallbackWithError(callback_); + InvokeNewSessionCallbackWithError(callback_); } -void PresentationServiceImpl::NewSessionMojoCallbackWrapper::Run( +void PresentationServiceImpl::NewSessionCallbackWrapper::Run( blink::mojom::PresentationSessionInfoPtr session, blink::mojom::PresentationErrorPtr error) { DCHECK(!callback_.is_null());
diff --git a/content/browser/presentation/presentation_service_impl.h b/content/browser/presentation/presentation_service_impl.h index 44fb0e10..2bdc3e9 100644 --- a/content/browser/presentation/presentation_service_impl.h +++ b/content/browser/presentation/presentation_service_impl.h
@@ -10,6 +10,7 @@ #include <memory> #include <string> +#include "base/callback.h" #include "base/compiler_specific.h" #include "base/containers/hash_tables.h" #include "base/gtest_prod_util.h" @@ -33,10 +34,6 @@ struct PresentationSessionMessage; class RenderFrameHost; -using NewSessionMojoCallback = - mojo::Callback<void(blink::mojom::PresentationSessionInfoPtr, - blink::mojom::PresentationErrorPtr)>; - // Implementation of Mojo PresentationService. // It handles Presentation API requests coming from Blink / renderer process // and delegates the requests to the embedder's media router via @@ -50,6 +47,10 @@ public WebContentsObserver, public PresentationServiceDelegate::Observer { public: + using NewSessionCallback = + base::Callback<void(blink::mojom::PresentationSessionInfoPtr, + blink::mojom::PresentationErrorPtr)>; + ~PresentationServiceImpl() override; // Static factory method to create an instance of PresentationServiceImpl. @@ -95,11 +96,9 @@ // Maximum number of pending JoinSession requests at any given time. static const int kMaxNumQueuedSessionRequests = 10; - using PresentationSessionMojoCallback = - mojo::Callback<void(blink::mojom::PresentationSessionInfoPtr)>; using SessionMessagesCallback = - mojo::Callback<void(mojo::Array<blink::mojom::SessionMessagePtr>)>; - using SendMessageMojoCallback = mojo::Callback<void(bool)>; + base::Callback<void(mojo::Array<blink::mojom::SessionMessagePtr>)>; + using SendSessionMessageCallback = base::Callback<void(bool)>; // Listener implementation owned by PresentationServiceImpl. An instance of // this is created when PresentationRequest.getAvailability() is resolved. @@ -123,21 +122,21 @@ PresentationServiceImpl* const service_; }; - // Ensures the provided NewSessionMojoCallback is invoked exactly once + // Ensures the provided NewSessionCallback is invoked exactly once // before it goes out of scope. - class NewSessionMojoCallbackWrapper { + class NewSessionCallbackWrapper { public: - explicit NewSessionMojoCallbackWrapper( - const NewSessionMojoCallback& callback); - ~NewSessionMojoCallbackWrapper(); + explicit NewSessionCallbackWrapper( + const NewSessionCallback& callback); + ~NewSessionCallbackWrapper(); void Run(blink::mojom::PresentationSessionInfoPtr session, blink::mojom::PresentationErrorPtr error); private: - NewSessionMojoCallback callback_; + NewSessionCallback callback_; - DISALLOW_COPY_AND_ASSIGN(NewSessionMojoCallbackWrapper); + DISALLOW_COPY_AND_ASSIGN(NewSessionCallbackWrapper); }; // |render_frame_host|: The RFH this instance is associated with. @@ -156,14 +155,14 @@ void StopListeningForScreenAvailability(const mojo::String& url) override; void StartSession( const mojo::String& presentation_url, - const NewSessionMojoCallback& callback) override; + const NewSessionCallback& callback) override; void JoinSession( const mojo::String& presentation_url, const mojo::String& presentation_id, - const NewSessionMojoCallback& callback) override; + const NewSessionCallback& callback) override; void SendSessionMessage(blink::mojom::PresentationSessionInfoPtr session_info, blink::mojom::SessionMessagePtr session_message, - const SendMessageMojoCallback& callback) override; + const SendSessionMessageCallback& callback) override; void CloseConnection(const mojo::String& presentation_url, const mojo::String& presentation_id) override; void Terminate(const mojo::String& presentation_url, @@ -236,7 +235,7 @@ // Associates a JoinSession |callback| with a unique request ID and // stores it in a map. // Returns a positive value on success. - int RegisterJoinSessionCallback(const NewSessionMojoCallback& callback); + int RegisterJoinSessionCallback(const NewSessionCallback& callback); // Invoked by the embedder's PresentationServiceDelegate when a // PresentationConnection's state has changed. @@ -264,10 +263,10 @@ // For StartSession requests. // Set to a positive value when a StartSession request is being processed. int start_session_request_id_; - std::unique_ptr<NewSessionMojoCallbackWrapper> pending_start_session_cb_; + std::unique_ptr<NewSessionCallbackWrapper> pending_start_session_cb_; // For JoinSession requests. - base::hash_map<int, linked_ptr<NewSessionMojoCallbackWrapper>> + base::hash_map<int, linked_ptr<NewSessionCallbackWrapper>> pending_join_session_cbs_; // RAII binding of |this| to an Presentation interface request. @@ -275,7 +274,7 @@ std::unique_ptr<mojo::Binding<blink::mojom::PresentationService>> binding_; // There can be only one send message request at a time. - std::unique_ptr<SendMessageMojoCallback> send_message_callback_; + std::unique_ptr<SendSessionMessageCallback> send_message_callback_; std::unique_ptr<SessionMessagesCallback> on_session_messages_callback_;
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc index 31e3d64..f6dbd5d0 100644 --- a/content/browser/presentation/presentation_service_impl_unittest.cc +++ b/content/browser/presentation/presentation_service_impl_unittest.cc
@@ -280,7 +280,7 @@ EXPECT_FALSE(service_impl_->on_session_messages_callback_.get()); } - void ExpectNewSessionMojoCallbackSuccess( + void ExpectNewSessionCallbackSuccess( blink::mojom::PresentationSessionInfoPtr info, blink::mojom::PresentationErrorPtr error) { EXPECT_FALSE(info.is_null()); @@ -289,7 +289,7 @@ run_loop_quit_closure_.Run(); } - void ExpectNewSessionMojoCallbackError( + void ExpectNewSessionCallbackError( blink::mojom::PresentationSessionInfoPtr info, blink::mojom::PresentationErrorPtr error) { EXPECT_TRUE(info.is_null()); @@ -308,7 +308,7 @@ } } - void ExpectSendMessageMojoCallback(bool success) { + void ExpectSendSessionMessageCallback(bool success) { EXPECT_TRUE(success); EXPECT_FALSE(service_impl_->send_message_callback_); if (!run_loop_quit_closure_.is_null()) @@ -545,7 +545,7 @@ service_ptr_->StartSession( kPresentationUrl, base::Bind( - &PresentationServiceImplTest::ExpectNewSessionMojoCallbackSuccess, + &PresentationServiceImplTest::ExpectNewSessionCallbackSuccess, base::Unretained(this))); base::RunLoop run_loop; base::Callback<void(const PresentationSessionInfo&)> success_cb; @@ -565,7 +565,7 @@ service_ptr_->StartSession( kPresentationUrl, base::Bind( - &PresentationServiceImplTest::ExpectNewSessionMojoCallbackError, + &PresentationServiceImplTest::ExpectNewSessionCallbackError, base::Unretained(this))); base::RunLoop run_loop; base::Callback<void(const PresentationError&)> error_cb; @@ -583,7 +583,7 @@ kPresentationUrl, kPresentationId, base::Bind( - &PresentationServiceImplTest::ExpectNewSessionMojoCallbackSuccess, + &PresentationServiceImplTest::ExpectNewSessionCallbackSuccess, base::Unretained(this))); base::RunLoop run_loop; base::Callback<void(const PresentationSessionInfo&)> success_cb; @@ -605,7 +605,7 @@ kPresentationUrl, kPresentationId, base::Bind( - &PresentationServiceImplTest::ExpectNewSessionMojoCallbackError, + &PresentationServiceImplTest::ExpectNewSessionCallbackError, base::Unretained(this))); base::RunLoop run_loop; base::Callback<void(const PresentationError&)> error_cb; @@ -666,7 +666,7 @@ service_ptr_->StartSession( presentation_url2, base::Bind( - &PresentationServiceImplTest::ExpectNewSessionMojoCallbackError, + &PresentationServiceImplTest::ExpectNewSessionCallbackError, base::Unretained(this))); SaveQuitClosureAndRunLoop(); } @@ -684,7 +684,7 @@ message_request->message = message; service_ptr_->SendSessionMessage( std::move(session), std::move(message_request), - base::Bind(&PresentationServiceImplTest::ExpectSendMessageMojoCallback, + base::Bind(&PresentationServiceImplTest::ExpectSendSessionMessageCallback, base::Unretained(this))); base::RunLoop run_loop; @@ -722,7 +722,7 @@ message_request->data = mojo::Array<uint8_t>::From(data); service_ptr_->SendSessionMessage( std::move(session), std::move(message_request), - base::Bind(&PresentationServiceImplTest::ExpectSendMessageMojoCallback, + base::Bind(&PresentationServiceImplTest::ExpectSendSessionMessageCallback, base::Unretained(this))); base::RunLoop run_loop; @@ -766,7 +766,7 @@ message_request->data = mojo::Array<uint8_t>::From(data); service_ptr_->SendSessionMessage( std::move(session), std::move(message_request), - base::Bind(&PresentationServiceImplTest::ExpectSendMessageMojoCallback, + base::Bind(&PresentationServiceImplTest::ExpectSendSessionMessageCallback, base::Unretained(this))); base::RunLoop run_loop; @@ -797,7 +797,7 @@ message_request->data = mojo::Array<uint8_t>::From(data); service_ptr_->SendSessionMessage( std::move(session), std::move(message_request), - base::Bind(&PresentationServiceImplTest::ExpectSendMessageMojoCallback, + base::Bind(&PresentationServiceImplTest::ExpectSendSessionMessageCallback, base::Unretained(this))); base::RunLoop run_loop; @@ -841,7 +841,7 @@ base::StringPrintf(presentation_url, i), base::StringPrintf(presentation_id, i), base::Bind( - &PresentationServiceImplTest::ExpectNewSessionMojoCallbackError, + &PresentationServiceImplTest::ExpectNewSessionCallbackError, base::Unretained(this))); SaveQuitClosureAndRunLoop(); }
diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc index 8287762b..fb1fbf0 100644 --- a/content/browser/webui/web_ui_mojo_browsertest.cc +++ b/content/browser/webui/web_ui_mojo_browsertest.cc
@@ -83,7 +83,7 @@ ~BrowserTargetImpl() override {} // mojom::BrowserTarget overrides: - void Start(const mojo::Closure& closure) override { + void Start(const StartCallback& closure) override { closure.Run(); } void Stop() override {
diff --git a/content/renderer/background_sync/background_sync_client_impl.h b/content/renderer/background_sync/background_sync_client_impl.h index 921ca854..a264ffc 100644 --- a/content/renderer/background_sync/background_sync_client_impl.h +++ b/content/renderer/background_sync/background_sync_client_impl.h
@@ -26,8 +26,6 @@ ~BackgroundSyncClientImpl() override; private: - using SyncCallback = - mojo::Callback<void(blink::mojom::ServiceWorkerEventStatus)>; explicit BackgroundSyncClientImpl( mojo::InterfaceRequest<blink::mojom::BackgroundSyncServiceClient> request);
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index 3c9cd7f9..6c98f733 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -671,7 +671,7 @@ mojom::FrameRequest TakeFrameRequest() { return std::move(frame_request_); } mojom::FrameHostPtr TakeFrameHost() { - frame_host_.set_connection_error_handler(mojo::Closure()); + frame_host_.set_connection_error_handler(base::Closure()); return std::move(frame_host_); }
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc index ae08701..1985a5e 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -172,7 +172,7 @@ using SkipWaitingCallbacksMap = IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer>; using SyncEventCallbacksMap = - IDMap<const mojo::Callback<void(blink::mojom::ServiceWorkerEventStatus)>, + IDMap<const base::Callback<void(blink::mojom::ServiceWorkerEventStatus)>, IDMapOwnPointer>; explicit WorkerContextData(ServiceWorkerContextClient* owner)
diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h index 48b4dbd..deaf7b0 100644 --- a/content/renderer/service_worker/service_worker_context_client.h +++ b/content/renderer/service_worker/service_worker_context_client.h
@@ -13,6 +13,7 @@ #include <string> #include <vector> +#include "base/callback.h" #include "base/id_map.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -64,7 +65,7 @@ : public blink::WebServiceWorkerContextClient { public: using SyncCallback = - mojo::Callback<void(blink::mojom::ServiceWorkerEventStatus)>; + base::Callback<void(blink::mojom::ServiceWorkerEventStatus)>; // Returns a thread-specific client instance. This does NOT create a // new instance.
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py index ba8db9e7..395fdef7 100644 --- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -30,11 +30,11 @@ # ======================== # Passing tests, waiting to be turned on when sharding is implemented. + self.Skip('deqp/functional/gles3/draw/*', bug=1) self.Skip('deqp/functional/gles3/shadermatrix/*', bug=1) # All platforms. self.Skip('deqp/functional/gles3/builtinprecision/*.html', bug=483282) - self.Skip('deqp/functional/gles3/draw.html', bug=483282) self.Skip('deqp/functional/gles3/fbocolorbuffer/*.html', bug=618408) self.Skip('deqp/functional/gles3/fboinvalidate.html', bug=483282) self.Skip('deqp/functional/gles3/fbomultisample.html', bug=483282) @@ -70,7 +70,7 @@ 'basic_copyteximage2d.html', ['win'], bug=483282) - self.Fail('deqp/functional/gles3/transformfeedback.html', + self.Fail('deqp/functional/gles3/transformfeedback/*.html', ['win'], bug=483282) self.Fail('deqp/functional/gles3/negativetextureapi.html', ['win'], bug=483282) @@ -337,7 +337,7 @@ ['mac', 'amd'], bug=598930) self.Fail('deqp/functional/gles3/shadercommonfunction.html', ['mac', 'amd'], bug=483282) - self.Fail('deqp/functional/gles3/transformfeedback.html', + self.Fail('deqp/functional/gles3/transformfeedback/*.html', ['mac', 'amd'], bug=483282) self.Fail('deqp/functional/gles3/shadertexturefunction/' + @@ -361,7 +361,7 @@ ['mac', 'intel'], bug=483282) self.Fail('deqp/functional/gles3/shaderderivate.html', ['mac', 'intel'], bug=483282) - self.Fail('deqp/functional/gles3/transformfeedback.html', + self.Fail('deqp/functional/gles3/transformfeedback/*.html', ['mac', 'intel'], bug=483282) self.Fail('deqp/functional/gles3/texturefiltering/2d_combinations_01.html', @@ -446,7 +446,7 @@ ['linux', 'nvidia', 'opengl'], bug=483282) self.Fail('conformance2/transform_feedback/transform_feedback.html', ['linux', 'nvidia', 'opengl'], bug=483282) - self.Fail('deqp/functional/gles3/transformfeedback.html', + self.Fail('deqp/functional/gles3/transformfeedback/*.html', ['linux', 'nvidia', 'opengl'], bug=618408) self.Fail('deqp/functional/gles3/shadercommonfunction.html', ['linux', 'nvidia', 'opengl'], bug=618408) @@ -510,7 +510,7 @@ ['linux', 'amd'], bug=483282) self.Fail('deqp/functional/gles3/negativetextureapi.html', ['linux', 'amd'], bug=483282) - self.Fail('deqp/functional/gles3/transformfeedback.html', + self.Fail('deqp/functional/gles3/transformfeedback/*.html', ['linux', 'amd'], bug=483282) self.Fail('deqp/functional/gles3/negativebufferapi.html', ['linux', 'amd'], bug=483282)
diff --git a/device/battery/battery_monitor_impl.cc b/device/battery/battery_monitor_impl.cc index 91f7772a..7a77c5b1 100644 --- a/device/battery/battery_monitor_impl.cc +++ b/device/battery/battery_monitor_impl.cc
@@ -30,7 +30,7 @@ } void BatteryMonitorImpl::QueryNextStatus( - const BatteryStatusCallback& callback) { + const QueryNextStatusCallback& callback) { if (!callback_.is_null()) { DVLOG(1) << "Overlapped call to QueryNextStatus!"; delete this;
diff --git a/device/battery/battery_monitor_impl.h b/device/battery/battery_monitor_impl.h index c6ab045..b03748a 100644 --- a/device/battery/battery_monitor_impl.h +++ b/device/battery/battery_monitor_impl.h
@@ -21,13 +21,11 @@ mojo::InterfaceRequest<BatteryMonitor> request); private: - typedef mojo::Callback<void(BatteryStatusPtr)> BatteryStatusCallback; - explicit BatteryMonitorImpl(mojo::InterfaceRequest<BatteryMonitor> request); ~BatteryMonitorImpl() override; // BatteryMonitor methods: - void QueryNextStatus(const BatteryStatusCallback& callback) override; + void QueryNextStatus(const QueryNextStatusCallback& callback) override; void RegisterSubscription(); void DidChange(const BatteryStatus& battery_status); @@ -36,7 +34,7 @@ mojo::StrongBinding<BatteryMonitor> binding_; std::unique_ptr<BatteryStatusService::BatteryUpdateSubscription> subscription_; - BatteryStatusCallback callback_; + QueryNextStatusCallback callback_; BatteryStatus status_; bool status_to_report_;
diff --git a/device/serial/data_sink_receiver.cc b/device/serial/data_sink_receiver.cc index 1352829a..1ae6389 100644 --- a/device/serial/data_sink_receiver.cc +++ b/device/serial/data_sink_receiver.cc
@@ -50,7 +50,7 @@ class DataSinkReceiver::DataFrame { public: explicit DataFrame(mojo::Array<uint8_t> data, - const mojo::Callback<void(uint32_t, int32_t)>& callback); + const serial::DataSink::OnDataCallback& callback); // Returns the number of unconsumed bytes remaining of this data frame. uint32_t GetRemainingBytes(); @@ -67,7 +67,7 @@ private: mojo::Array<uint8_t> data_; uint32_t offset_; - const mojo::Callback<void(uint32_t, int32_t)> callback_; + const serial::DataSink::OnDataCallback callback_; }; DataSinkReceiver::DataSinkReceiver( @@ -121,7 +121,7 @@ void DataSinkReceiver::OnData( mojo::Array<uint8_t> data, - const mojo::Callback<void(uint32_t, int32_t)>& callback) { + const serial::DataSink::OnDataCallback& callback) { if (current_error_) { callback.Run(0, current_error_); return; @@ -256,7 +256,7 @@ DataSinkReceiver::DataFrame::DataFrame( mojo::Array<uint8_t> data, - const mojo::Callback<void(uint32_t, int32_t)>& callback) + const serial::DataSink::OnDataCallback& callback) : data_(std::move(data)), offset_(0), callback_(callback) { DCHECK_LT(0u, data_.size()); }
diff --git a/device/serial/data_sink_receiver.h b/device/serial/data_sink_receiver.h index 03ae098f..57030d17 100644 --- a/device/serial/data_sink_receiver.h +++ b/device/serial/data_sink_receiver.h
@@ -52,10 +52,10 @@ ~DataSinkReceiver() override; - // mojo::InterfaceImpl<serial::DataSink> overrides. + // serial::DataSink overrides. void Cancel(int32_t error) override; void OnData(mojo::Array<uint8_t> data, - const mojo::Callback<void(uint32_t, int32_t)>& callback) override; + const OnDataCallback& callback) override; void ClearError() override; void OnConnectionError();
diff --git a/device/serial/serial_connection.cc b/device/serial/serial_connection.cc index 27bff5d..31cf341 100644 --- a/device/serial/serial_connection.cc +++ b/device/serial/serial_connection.cc
@@ -39,29 +39,28 @@ io_handler_->CancelWrite(serial::SendError::DISCONNECTED); } -void SerialConnection::GetInfo( - const mojo::Callback<void(serial::ConnectionInfoPtr)>& callback) { +void SerialConnection::GetInfo(const GetInfoCallback& callback) { callback.Run(io_handler_->GetPortInfo()); } void SerialConnection::SetOptions(serial::ConnectionOptionsPtr options, - const mojo::Callback<void(bool)>& callback) { + const SetOptionsCallback& callback) { callback.Run(io_handler_->ConfigurePort(*options)); io_handler_->CancelRead(device::serial::ReceiveError::NONE); } void SerialConnection::SetControlSignals( serial::HostControlSignalsPtr signals, - const mojo::Callback<void(bool)>& callback) { + const SetControlSignalsCallback& callback) { callback.Run(io_handler_->SetControlSignals(*signals)); } void SerialConnection::GetControlSignals( - const mojo::Callback<void(serial::DeviceControlSignalsPtr)>& callback) { + const GetControlSignalsCallback& callback) { callback.Run(io_handler_->GetControlSignals()); } -void SerialConnection::Flush(const mojo::Callback<void(bool)>& callback) { +void SerialConnection::Flush(const FlushCallback& callback) { callback.Run(io_handler_->Flush()); }
diff --git a/device/serial/serial_connection.h b/device/serial/serial_connection.h index 32c2ca2..a0e2a801 100644 --- a/device/serial/serial_connection.h +++ b/device/serial/serial_connection.h
@@ -32,16 +32,13 @@ ~SerialConnection() override; // serial::Connection overrides. - void GetInfo( - const mojo::Callback<void(serial::ConnectionInfoPtr)>& callback) override; + void GetInfo(const GetInfoCallback& callback) override; void SetOptions(serial::ConnectionOptionsPtr options, - const mojo::Callback<void(bool)>& callback) override; + const SetOptionsCallback& callback) override; void SetControlSignals(serial::HostControlSignalsPtr signals, - const mojo::Callback<void(bool)>& callback) override; - void GetControlSignals( - const mojo::Callback<void(serial::DeviceControlSignalsPtr)>& callback) - override; - void Flush(const mojo::Callback<void(bool)>& callback) override; + const SetControlSignalsCallback& callback) override; + void GetControlSignals(const GetControlSignalsCallback& callback) override; + void Flush(const FlushCallback& callback) override; private: void OnSendPipeReady(std::unique_ptr<ReadOnlyBuffer> buffer);
diff --git a/device/serial/serial_service_impl.cc b/device/serial/serial_service_impl.cc index a66abea..97ad57f86 100644 --- a/device/serial/serial_service_impl.cc +++ b/device/serial/serial_service_impl.cc
@@ -56,8 +56,7 @@ ui_task_runner, base::Passed(&request))); } -void SerialServiceImpl::GetDevices( - const mojo::Callback<void(mojo::Array<serial::DeviceInfoPtr>)>& callback) { +void SerialServiceImpl::GetDevices(const GetDevicesCallback& callback) { callback.Run(GetDeviceEnumerator()->GetDevices()); }
diff --git a/device/serial/serial_service_impl.h b/device/serial/serial_service_impl.h index cb4bc2ac..464e4ae 100644 --- a/device/serial/serial_service_impl.h +++ b/device/serial/serial_service_impl.h
@@ -37,9 +37,7 @@ mojo::InterfaceRequest<serial::SerialService> request); // SerialService overrides. - void GetDevices( - const mojo::Callback<void(mojo::Array<serial::DeviceInfoPtr>)>& callback) - override; + void GetDevices(const GetDevicesCallback& callback) override; void Connect( const mojo::String& path, serial::ConnectionOptionsPtr options,
diff --git a/device/usb/mojo/BUILD.gn b/device/usb/mojo/BUILD.gn index a2cc898..1a45f386 100644 --- a/device/usb/mojo/BUILD.gn +++ b/device/usb/mojo/BUILD.gn
@@ -20,7 +20,6 @@ "//device/usb/public/interfaces", "//mojo/common", "//mojo/public/cpp/bindings", - "//mojo/public/cpp/bindings:callback", "//net", ] }
diff --git a/device/usb/mojo/device_impl.cc b/device/usb/mojo/device_impl.cc index 5f7d193..6269b05 100644 --- a/device/usb/mojo/device_impl.cc +++ b/device/usb/mojo/device_impl.cc
@@ -27,30 +27,9 @@ namespace { using MojoTransferInCallback = - mojo::Callback<void(TransferStatus, mojo::Array<uint8_t>)>; + base::Callback<void(TransferStatus, mojo::Array<uint8_t>)>; -using MojoTransferOutCallback = mojo::Callback<void(TransferStatus)>; - -template <typename... Args> -void CallMojoCallback(std::unique_ptr<mojo::Callback<void(Args...)>> callback, - Args... args) { - callback->Run(args...); -} - -// Generic wrapper to convert a Mojo callback to something we can rebind and -// pass around. This is only usable for callbacks with no move-only arguments. -template <typename... Args> -base::Callback<void(Args...)> WrapMojoCallback( - const mojo::Callback<void(Args...)>& callback) { - // mojo::Callback is not thread safe. By wrapping |callback| in a scoped_ptr - // we guarantee that it will be freed when CallMojoCallback is run and not - // retained until the base::Callback is destroyed, which could happen on any - // thread. This pattern is also used below in places where this generic - // wrapper is not used. - auto callback_ptr = - base::WrapUnique(new mojo::Callback<void(Args...)>(callback)); - return base::Bind(&CallMojoCallback<Args...>, base::Passed(&callback_ptr)); -} +using MojoTransferOutCallback = base::Callback<void(TransferStatus)>; scoped_refptr<net::IOBuffer> CreateTransferBuffer(size_t size) { scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer( @@ -257,7 +236,7 @@ if (permission_provider_ && permission_provider_->HasConfigurationPermission(value, device_)) { - device_handle_->SetConfiguration(value, WrapMojoCallback(callback)); + device_handle_->SetConfiguration(value, callback); } else { callback.Run(false); } @@ -290,8 +269,7 @@ permission_provider_->HasFunctionPermission(interface_it->first_interface, config->configuration_value, device_)) { - device_handle_->ClaimInterface(interface_number, - WrapMojoCallback(callback)); + device_handle_->ClaimInterface(interface_number, callback); } else { callback.Run(false); } @@ -304,8 +282,7 @@ return; } - device_handle_->ReleaseInterface(interface_number, - WrapMojoCallback(callback)); + device_handle_->ReleaseInterface(interface_number, callback); } void DeviceImpl::SetInterfaceAlternateSetting( @@ -317,8 +294,8 @@ return; } - device_handle_->SetInterfaceAlternateSetting( - interface_number, alternate_setting, WrapMojoCallback(callback)); + device_handle_->SetInterfaceAlternateSetting(interface_number, + alternate_setting, callback); } void DeviceImpl::Reset(const ResetCallback& callback) { @@ -327,7 +304,7 @@ return; } - device_handle_->ResetDevice(WrapMojoCallback(callback)); + device_handle_->ResetDevice(callback); } void DeviceImpl::ClearHalt(uint8_t endpoint, @@ -337,7 +314,7 @@ return; } - device_handle_->ClearHalt(endpoint, WrapMojoCallback(callback)); + device_handle_->ClearHalt(endpoint, callback); } void DeviceImpl::ControlTransferIn(ControlTransferParamsPtr params,
diff --git a/device/usb/mojo/device_impl.h b/device/usb/mojo/device_impl.h index e9cc622..38a03ce 100644 --- a/device/usb/mojo/device_impl.h +++ b/device/usb/mojo/device_impl.h
@@ -16,7 +16,6 @@ #include "device/usb/public/interfaces/device.mojom.h" #include "device/usb/usb_device.h" #include "device/usb/usb_device_handle.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/strong_binding.h"
diff --git a/device/usb/mojo/device_manager_impl.h b/device/usb/mojo/device_manager_impl.h index 2bc524a..87b79d8 100644 --- a/device/usb/mojo/device_manager_impl.h +++ b/device/usb/mojo/device_manager_impl.h
@@ -9,6 +9,7 @@ #include <queue> #include <set> +#include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -45,7 +46,7 @@ mojo::InterfaceRequest<DeviceManager> request); ~DeviceManagerImpl() override; - void set_connection_error_handler(const mojo::Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { connection_error_handler_ = error_handler; } @@ -75,7 +76,7 @@ ScopedObserver<UsbService, UsbService::Observer> observer_; DeviceManagerClientPtr client_; - mojo::Closure connection_error_handler_; + base::Closure connection_error_handler_; mojo::StrongBinding<DeviceManager> binding_; base::WeakPtrFactory<DeviceManagerImpl> weak_factory_;
diff --git a/extensions/browser/api/mime_handler_private/mime_handler_private.cc b/extensions/browser/api/mime_handler_private/mime_handler_private.cc index 120363c..229ea83 100644 --- a/extensions/browser/api/mime_handler_private/mime_handler_private.cc +++ b/extensions/browser/api/mime_handler_private/mime_handler_private.cc
@@ -65,7 +65,7 @@ } void MimeHandlerServiceImpl::GetStreamInfo( - const mojo::Callback<void(mime_handler::StreamInfoPtr)>& callback) { + const GetStreamInfoCallback& callback) { if (!stream_) { callback.Run(mime_handler::StreamInfoPtr()); return; @@ -73,8 +73,7 @@ callback.Run(mojo::ConvertTo<mime_handler::StreamInfoPtr>(*stream_)); } -void MimeHandlerServiceImpl::AbortStream( - const mojo::Callback<void()>& callback) { +void MimeHandlerServiceImpl::AbortStream(const AbortStreamCallback& callback) { if (!stream_) { callback.Run(); return; @@ -84,7 +83,7 @@ } void MimeHandlerServiceImpl::OnStreamClosed( - const mojo::Callback<void()>& callback) { + const AbortStreamCallback& callback) { callback.Run(); }
diff --git a/extensions/browser/api/mime_handler_private/mime_handler_private.h b/extensions/browser/api/mime_handler_private/mime_handler_private.h index 15e34e8..432c40dc 100644 --- a/extensions/browser/api/mime_handler_private/mime_handler_private.h +++ b/extensions/browser/api/mime_handler_private/mime_handler_private.h
@@ -5,6 +5,7 @@ #ifndef EXTENSIONS_BROWSER_API_MIME_HANDLER_PRIVATE_MIME_HANDLER_PRIVATE_H_ #define EXTENSIONS_BROWSER_API_MIME_HANDLER_PRIVATE_MIME_HANDLER_PRIVATE_H_ +#include "base/callback.h" #include "base/memory/weak_ptr.h" #include "extensions/common/api/mime_handler.mojom.h" #include "mojo/public/cpp/bindings/strong_binding.h" @@ -28,12 +29,11 @@ ~MimeHandlerServiceImpl() override; // mime_handler::MimeHandlerService overrides. - void GetStreamInfo(const mojo::Callback<void(mime_handler::StreamInfoPtr)>& - callback) override; - void AbortStream(const mojo::Callback<void()>& callback) override; + void GetStreamInfo(const GetStreamInfoCallback& callback) override; + void AbortStream(const AbortStreamCallback& callback) override; // Invoked by the callback used to abort |stream_|. - void OnStreamClosed(const mojo::Callback<void()>& callback); + void OnStreamClosed(const AbortStreamCallback& callback); // A handle to the stream being handled by the MimeHandlerViewGuest. base::WeakPtr<StreamContainer> stream_;
diff --git a/extensions/browser/mojo/stash_backend.cc b/extensions/browser/mojo/stash_backend.cc index 8104c4d0..7da6574 100644 --- a/extensions/browser/mojo/stash_backend.cc +++ b/extensions/browser/mojo/stash_backend.cc
@@ -27,9 +27,7 @@ // StashService overrides. void AddToStash(mojo::Array<StashedObjectPtr> stash) override; - void RetrieveStash( - const mojo::Callback<void(mojo::Array<StashedObjectPtr> stash)>& callback) - override; + void RetrieveStash(const RetrieveStashCallback& callback) override; private: mojo::StrongBinding<StashService> binding_; @@ -52,8 +50,7 @@ backend_->AddToStash(std::move(stashed_objects)); } -void StashServiceImpl::RetrieveStash( - const mojo::Callback<void(mojo::Array<StashedObjectPtr>)>& callback) { +void StashServiceImpl::RetrieveStash(const RetrieveStashCallback& callback) { if (!backend_) { callback.Run(mojo::Array<StashedObjectPtr>()); return;
diff --git a/ipc/mojo/ipc_mojo_bootstrap.cc b/ipc/mojo/ipc_mojo_bootstrap.cc index 434f0027..b488dd5 100644 --- a/ipc/mojo/ipc_mojo_bootstrap.cc +++ b/ipc/mojo/ipc_mojo_bootstrap.cc
@@ -7,6 +7,7 @@ #include <stdint.h> #include <utility> +#include "base/callback.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" @@ -74,7 +75,7 @@ } set_state(STATE_READY); - bootstrap_.set_connection_error_handler(mojo::Closure()); + bootstrap_.set_connection_error_handler(base::Closure()); delegate()->OnPipesAvailable(std::move(send_channel_), std::move(receive_channel_request_), peer_pid); } @@ -93,7 +94,7 @@ void Init(mojom::ChannelAssociatedRequest receive_channel, mojom::ChannelAssociatedPtrInfo send_channel, int32_t peer_pid, - const mojo::Callback<void(int32_t)>& callback) override; + const InitCallback& callback) override; mojo::Binding<mojom::Bootstrap> binding_; @@ -111,10 +112,10 @@ void MojoClientBootstrap::Init(mojom::ChannelAssociatedRequest receive_channel, mojom::ChannelAssociatedPtrInfo send_channel, int32_t peer_pid, - const mojo::Callback<void(int32_t)>& callback) { + const InitCallback& callback) { callback.Run(GetSelfPID()); set_state(STATE_READY); - binding_.set_connection_error_handler(mojo::Closure()); + binding_.set_connection_error_handler(base::Closure()); delegate()->OnPipesAvailable(std::move(send_channel), std::move(receive_channel), peer_pid); }
diff --git a/media/capture/video/scoped_result_callback.h b/media/capture/video/scoped_result_callback.h index 59727ed..af4edc1 100644 --- a/media/capture/video/scoped_result_callback.h +++ b/media/capture/video/scoped_result_callback.h
@@ -5,9 +5,9 @@ #ifndef MEDIA_CAPTURE_VIDEO_SCOPED_RESULT_CALLBACK_H_ #define MEDIA_CAPTURE_VIDEO_SCOPED_RESULT_CALLBACK_H_ -#include "base/callback_forward.h" +#include "base/callback.h" +#include "base/callback_helpers.h" #include "base/macros.h" -#include "mojo/public/cpp/bindings/callback.h" namespace media { @@ -41,10 +41,7 @@ template <typename... Args> void Run(Args... args) { on_error_callback_.Reset(); - // TODO(mcasas): Use base::ResetAndReturn() when mojo::Callback<> is - // compatible with base::Callback<>, see https://crbug.com/596521. - callback_.Run(std::forward<Args>(args)...); - callback_.Reset(); + base::ResetAndReturn(&callback_).Run(std::forward<Args>(args)...); } private:
diff --git a/media/capture/video/video_capture_device.h b/media/capture/video/video_capture_device.h index 4cd89b54..ece44329 100644 --- a/media/capture/video/video_capture_device.h +++ b/media/capture/video/video_capture_device.h
@@ -19,6 +19,7 @@ #include <memory> #include <string> +#include "base/callback.h" #include "base/files/file.h" #include "base/logging.h" #include "base/memory/ref_counted.h" @@ -30,7 +31,6 @@ #include "media/base/video_frame.h" #include "media/capture/video/scoped_result_callback.h" #include "mojo/public/cpp/bindings/array.h" -#include "mojo/public/cpp/bindings/callback.h" #include "ui/gfx/gpu_memory_buffer.h" namespace tracked_objects { @@ -315,7 +315,7 @@ // and/or interrupting the capture flow. Runs |callback| on the thread // where TakePhoto() is called, if the photo was successfully taken. using TakePhotoCallback = - mojo::Callback<void(mojo::String, mojo::Array<uint8_t>)>; + base::Callback<void(mojo::String, mojo::Array<uint8_t>)>; virtual void TakePhoto(ScopedResultCallback<TakePhotoCallback> callback); // Gets the power line frequency, either from the params if specified by the
diff --git a/media/mojo/clients/mojo_demuxer_stream_impl.h b/media/mojo/clients/mojo_demuxer_stream_impl.h index 49d97b7..9ead60e2 100644 --- a/media/mojo/clients/mojo_demuxer_stream_impl.h +++ b/media/mojo/clients/mojo_demuxer_stream_impl.h
@@ -5,6 +5,7 @@ #ifndef MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_STREAM_IMPL_H_ #define MEDIA_MOJO_CLIENTS_MOJO_DEMUXER_STREAM_IMPL_H_ +#include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "media/base/demuxer_stream.h" @@ -33,7 +34,7 @@ // Sets an error handler that will be called if a connection error occurs on // the bound message pipe. - void set_connection_error_handler(const mojo::Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { binding_.set_connection_error_handler(error_handler); }
diff --git a/media/mojo/services/mojo_cdm_promise.h b/media/mojo/services/mojo_cdm_promise.h index c380863..0d82b2b 100644 --- a/media/mojo/services/mojo_cdm_promise.h +++ b/media/mojo/services/mojo_cdm_promise.h
@@ -7,19 +7,19 @@ #include <stdint.h> +#include "base/callback.h" #include "base/macros.h" #include "media/base/cdm_promise.h" #include "media/mojo/common/mojo_type_trait.h" #include "media/mojo/interfaces/content_decryption_module.mojom.h" -#include "mojo/public/cpp/bindings/callback.h" namespace media { -// media::CdmPromiseTemplate implementations backed by mojo::Callbacks. +// media::CdmPromiseTemplate implementations backed by base::Callbacks. template <typename... T> class MojoCdmPromise : public CdmPromiseTemplate<T...> { public: - typedef mojo::Callback<void(mojom::CdmPromiseResultPtr, + typedef base::Callback<void(mojom::CdmPromiseResultPtr, typename MojoTypeTrait<T>::MojoType...)> CallbackType;
diff --git a/media/mojo/services/mojo_cdm_service.cc b/media/mojo/services/mojo_cdm_service.cc index bc0c6b07..b07bee0 100644 --- a/media/mojo/services/mojo_cdm_service.cc +++ b/media/mojo/services/mojo_cdm_service.cc
@@ -125,7 +125,7 @@ void MojoCdmService::SetServerCertificate( mojo::Array<uint8_t> certificate_data, - const mojo::Callback<void(mojom::CdmPromiseResultPtr)>& callback) { + const SetServerCertificateCallback& callback) { DVLOG(2) << __FUNCTION__; cdm_->SetServerCertificate( certificate_data.storage(), @@ -136,8 +136,7 @@ mojom::ContentDecryptionModule::SessionType session_type, mojom::ContentDecryptionModule::InitDataType init_data_type, mojo::Array<uint8_t> init_data, - const mojo::Callback<void(mojom::CdmPromiseResultPtr, mojo::String)>& - callback) { + const CreateSessionAndGenerateRequestCallback& callback) { DVLOG(2) << __FUNCTION__; cdm_->CreateSessionAndGenerateRequest( static_cast<MediaKeys::SessionType>(session_type), @@ -148,35 +147,31 @@ void MojoCdmService::LoadSession( mojom::ContentDecryptionModule::SessionType session_type, const mojo::String& session_id, - const mojo::Callback<void(mojom::CdmPromiseResultPtr, mojo::String)>& - callback) { + const LoadSessionCallback& callback) { DVLOG(2) << __FUNCTION__; cdm_->LoadSession(static_cast<MediaKeys::SessionType>(session_type), session_id.To<std::string>(), base::WrapUnique(new NewSessionMojoCdmPromise(callback))); } -void MojoCdmService::UpdateSession( - const mojo::String& session_id, - mojo::Array<uint8_t> response, - const mojo::Callback<void(mojom::CdmPromiseResultPtr)>& callback) { +void MojoCdmService::UpdateSession(const mojo::String& session_id, + mojo::Array<uint8_t> response, + const UpdateSessionCallback& callback) { DVLOG(2) << __FUNCTION__; cdm_->UpdateSession( session_id.To<std::string>(), response.storage(), std::unique_ptr<SimpleCdmPromise>(new SimpleMojoCdmPromise(callback))); } -void MojoCdmService::CloseSession( - const mojo::String& session_id, - const mojo::Callback<void(mojom::CdmPromiseResultPtr)>& callback) { +void MojoCdmService::CloseSession(const mojo::String& session_id, + const CloseSessionCallback& callback) { DVLOG(2) << __FUNCTION__; cdm_->CloseSession(session_id.To<std::string>(), base::WrapUnique(new SimpleMojoCdmPromise(callback))); } -void MojoCdmService::RemoveSession( - const mojo::String& session_id, - const mojo::Callback<void(mojom::CdmPromiseResultPtr)>& callback) { +void MojoCdmService::RemoveSession(const mojo::String& session_id, + const RemoveSessionCallback& callback) { DVLOG(2) << __FUNCTION__; cdm_->RemoveSession(session_id.To<std::string>(), base::WrapUnique(new SimpleMojoCdmPromise(callback)));
diff --git a/media/mojo/services/mojo_cdm_service.h b/media/mojo/services/mojo_cdm_service.h index 2e1aa782..b2df1fa 100644 --- a/media/mojo/services/mojo_cdm_service.h +++ b/media/mojo/services/mojo_cdm_service.h
@@ -55,29 +55,23 @@ const mojo::String& security_origin, mojom::CdmConfigPtr cdm_config, const InitializeCallback& callback) final; - void SetServerCertificate( - mojo::Array<uint8_t> certificate_data, - const mojo::Callback<void(mojom::CdmPromiseResultPtr)>& callback) final; + void SetServerCertificate(mojo::Array<uint8_t> certificate_data, + const SetServerCertificateCallback& callback) final; void CreateSessionAndGenerateRequest( mojom::ContentDecryptionModule::SessionType session_type, mojom::ContentDecryptionModule::InitDataType init_data_type, mojo::Array<uint8_t> init_data, - const mojo::Callback<void(mojom::CdmPromiseResultPtr, mojo::String)>& - callback) final; + const CreateSessionAndGenerateRequestCallback& callback) final; void LoadSession(mojom::ContentDecryptionModule::SessionType session_type, const mojo::String& session_id, - const mojo::Callback<void(mojom::CdmPromiseResultPtr, - mojo::String)>& callback) final; - void UpdateSession( - const mojo::String& session_id, - mojo::Array<uint8_t> response, - const mojo::Callback<void(mojom::CdmPromiseResultPtr)>& callback) final; - void CloseSession( - const mojo::String& session_id, - const mojo::Callback<void(mojom::CdmPromiseResultPtr)>& callback) final; - void RemoveSession( - const mojo::String& session_id, - const mojo::Callback<void(mojom::CdmPromiseResultPtr)>& callback) final; + const LoadSessionCallback& callback) final; + void UpdateSession(const mojo::String& session_id, + mojo::Array<uint8_t> response, + const UpdateSessionCallback& callback) final; + void CloseSession(const mojo::String& session_id, + const CloseSessionCallback& callback) final; + void RemoveSession(const mojo::String& session_id, + const RemoveSessionCallback& callback) final; // Get CDM to be used by the media pipeline. scoped_refptr<MediaKeys> GetCdm();
diff --git a/media/mojo/services/mojo_decryptor_service.cc b/media/mojo/services/mojo_decryptor_service.cc index dc42176..f335774 100644 --- a/media/mojo/services/mojo_decryptor_service.cc +++ b/media/mojo/services/mojo_decryptor_service.cc
@@ -24,7 +24,7 @@ MojoDecryptorService::MojoDecryptorService( const scoped_refptr<MediaKeys>& cdm, mojo::InterfaceRequest<mojom::Decryptor> request, - const mojo::Closure& error_handler) + const base::Closure& error_handler) : binding_(this, std::move(request)), cdm_(cdm), weak_factory_(this) { DVLOG(1) << __FUNCTION__; decryptor_ = cdm->GetCdmContext()->GetDecryptor();
diff --git a/media/mojo/services/mojo_decryptor_service.h b/media/mojo/services/mojo_decryptor_service.h index 8857346..58dc7bc4 100644 --- a/media/mojo/services/mojo_decryptor_service.h +++ b/media/mojo/services/mojo_decryptor_service.h
@@ -10,13 +10,13 @@ #include <unordered_map> +#include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "media/base/decryptor.h" #include "media/mojo/interfaces/decryptor.mojom.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/system/data_pipe.h" namespace media { @@ -33,7 +33,7 @@ // |error_handler| will be called if a connection error occurs. MojoDecryptorService(const scoped_refptr<MediaKeys>& cdm, mojo::InterfaceRequest<mojom::Decryptor> request, - const mojo::Closure& error_handler); + const base::Closure& error_handler); ~MojoDecryptorService() final;
diff --git a/media/mojo/services/mojo_renderer_service.cc b/media/mojo/services/mojo_renderer_service.cc index 9c6f2adf..5d75037 100644 --- a/media/mojo/services/mojo_renderer_service.cc +++ b/media/mojo/services/mojo_renderer_service.cc
@@ -36,11 +36,10 @@ MojoRendererService::~MojoRendererService() { } -void MojoRendererService::Initialize( - mojom::RendererClientPtr client, - mojom::DemuxerStreamPtr audio, - mojom::DemuxerStreamPtr video, - const mojo::Callback<void(bool)>& callback) { +void MojoRendererService::Initialize(mojom::RendererClientPtr client, + mojom::DemuxerStreamPtr audio, + mojom::DemuxerStreamPtr video, + const InitializeCallback& callback) { DVLOG(1) << __FUNCTION__; DCHECK_EQ(state_, STATE_UNINITIALIZED); client_ = std::move(client); @@ -50,7 +49,7 @@ base::Bind(&MojoRendererService::OnStreamReady, weak_this_, callback))); } -void MojoRendererService::Flush(const mojo::Closure& callback) { +void MojoRendererService::Flush(const FlushCallback& callback) { DVLOG(2) << __FUNCTION__; DCHECK_EQ(state_, STATE_PLAYING); @@ -78,7 +77,7 @@ } void MojoRendererService::SetCdm(int32_t cdm_id, - const mojo::Callback<void(bool)>& callback) { + const SetCdmCallback& callback) { if (!mojo_cdm_service_context_) { DVLOG(1) << "CDM service context not available."; callback.Run(false); @@ -139,7 +138,7 @@ } void MojoRendererService::OnStreamReady( - const mojo::Callback<void(bool)>& callback) { + const base::Callback<void(bool)>& callback) { DCHECK_EQ(state_, STATE_INITIALIZING); renderer_->Initialize( @@ -149,7 +148,7 @@ } void MojoRendererService::OnRendererInitializeDone( - const mojo::Callback<void(bool)>& callback, + const base::Callback<void(bool)>& callback, PipelineStatus status) { DVLOG(1) << __FUNCTION__; DCHECK_EQ(state_, STATE_INITIALIZING); @@ -188,7 +187,7 @@ base::Bind(&MojoRendererService::UpdateMediaTime, weak_this_, false)); } -void MojoRendererService::OnFlushCompleted(const mojo::Closure& callback) { +void MojoRendererService::OnFlushCompleted(const FlushCallback& callback) { DVLOG(1) << __FUNCTION__; DCHECK_EQ(state_, STATE_FLUSHING); state_ = STATE_PLAYING; @@ -197,7 +196,7 @@ void MojoRendererService::OnCdmAttached( scoped_refptr<MediaKeys> cdm, - const mojo::Callback<void(bool)>& callback, + const base::Callback<void(bool)>& callback, bool success) { DVLOG(1) << __FUNCTION__ << "(" << success << ")";
diff --git a/media/mojo/services/mojo_renderer_service.h b/media/mojo/services/mojo_renderer_service.h index 58b1ce7..fb10873 100644 --- a/media/mojo/services/mojo_renderer_service.h +++ b/media/mojo/services/mojo_renderer_service.h
@@ -9,6 +9,7 @@ #include <memory> +#include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -44,12 +45,12 @@ void Initialize(mojom::RendererClientPtr client, mojom::DemuxerStreamPtr audio, mojom::DemuxerStreamPtr video, - const mojo::Callback<void(bool)>& callback) final; - void Flush(const mojo::Closure& callback) final; + const InitializeCallback& callback) final; + void Flush(const FlushCallback& callback) final; void StartPlayingFrom(int64_t time_delta_usec) final; void SetPlaybackRate(double playback_rate) final; void SetVolume(float volume) final; - void SetCdm(int32_t cdm_id, const mojo::Callback<void(bool)>& callback) final; + void SetCdm(int32_t cdm_id, const SetCdmCallback& callback) final; private: enum State { @@ -71,10 +72,10 @@ // Called when the DemuxerStreamProviderShim is ready to go (has a config, // pipe handle, etc) and can be handed off to a renderer for use. - void OnStreamReady(const mojo::Callback<void(bool)>& callback); + void OnStreamReady(const base::Callback<void(bool)>& callback); // Called when |audio_renderer_| initialization has completed. - void OnRendererInitializeDone(const mojo::Callback<void(bool)>& callback, + void OnRendererInitializeDone(const base::Callback<void(bool)>& callback, PipelineStatus status); // Periodically polls the media time from the renderer and notifies the client @@ -85,11 +86,11 @@ void SchedulePeriodicMediaTimeUpdates(); // Callback executed once Flush() completes. - void OnFlushCompleted(const mojo::Closure& callback); + void OnFlushCompleted(const FlushCallback& callback); // Callback executed once SetCdm() completes. void OnCdmAttached(scoped_refptr<MediaKeys> cdm, - const mojo::Callback<void(bool)>& callback, + const base::Callback<void(bool)>& callback, bool success); mojo::StrongBinding<mojom::Renderer> binding_;
diff --git a/mojo/mojo_public.gypi b/mojo/mojo_public.gypi index 9014741..e30cee7 100644 --- a/mojo/mojo_public.gypi +++ b/mojo/mojo_public.gypi
@@ -17,7 +17,6 @@ 'public/cpp/bindings/associated_interface_request.h', 'public/cpp/bindings/binding.h', 'public/cpp/bindings/binding_set.h', - 'public/cpp/bindings/callback.h', 'public/cpp/bindings/enum_traits.h', 'public/cpp/bindings/interface_ptr.h', 'public/cpp/bindings/interface_ptr_set.h',
diff --git a/mojo/public/cpp/bindings/BUILD.gn b/mojo/public/cpp/bindings/BUILD.gn index 23f92455..b52ffcc 100644 --- a/mojo/public/cpp/bindings/BUILD.gn +++ b/mojo/public/cpp/bindings/BUILD.gn
@@ -117,7 +117,6 @@ ] public_deps = [ - ":callback", ":struct_traits", "//base", "//ipc:param_traits", @@ -130,16 +129,6 @@ ] } -source_set("callback") { - sources = [ - "callback.h", - ] - - public_deps = [ - "//base", - ] -} - source_set("struct_traits") { sources = [ "struct_traits.h",
diff --git a/mojo/public/cpp/bindings/associated_binding.h b/mojo/public/cpp/bindings/associated_binding.h index 495bce8f..08779bb9 100644 --- a/mojo/public/cpp/bindings/associated_binding.h +++ b/mojo/public/cpp/bindings/associated_binding.h
@@ -9,6 +9,7 @@ #include <utility> #include "base/bind.h" +#include "base/callback.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" @@ -16,7 +17,6 @@ #include "base/threading/thread_task_runner_handle.h" #include "mojo/public/cpp/bindings/associated_group.h" #include "mojo/public/cpp/bindings/associated_interface_request.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/lib/interface_endpoint_client.h" #include "mojo/public/cpp/bindings/lib/multiplex_router.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" @@ -137,7 +137,7 @@ // This method may only be called after this AssociatedBinding has been bound // to a message pipe. The error handler will be reset when this // AssociatedBinding is unbound or closed. - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { DCHECK(is_bound()); connection_error_handler_ = error_handler; } @@ -164,7 +164,7 @@ typename Interface::Stub_ stub_; Interface* impl_; - Closure connection_error_handler_; + base::Closure connection_error_handler_; DISALLOW_COPY_AND_ASSIGN(AssociatedBinding); };
diff --git a/mojo/public/cpp/bindings/associated_interface_ptr.h b/mojo/public/cpp/bindings/associated_interface_ptr.h index 9846b33d5..10494ce 100644 --- a/mojo/public/cpp/bindings/associated_interface_ptr.h +++ b/mojo/public/cpp/bindings/associated_interface_ptr.h
@@ -8,6 +8,7 @@ #include <stdint.h> #include <utility> +#include "base/callback.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -16,7 +17,6 @@ #include "mojo/public/cpp/bindings/associated_group.h" #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" #include "mojo/public/cpp/bindings/associated_interface_request.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h" namespace mojo { @@ -92,7 +92,7 @@ // Queries the max version that the remote side supports. On completion, the // result will be returned as the input of |callback|. The version number of // this object will also be updated. - void QueryVersion(const Callback<void(uint32_t)>& callback) { + void QueryVersion(const base::Callback<void(uint32_t)>& callback) { internal_state_.QueryVersion(callback); } @@ -122,7 +122,7 @@ // // This method may only be called after the AssociatedInterfacePtr has been // bound. - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { internal_state_.set_connection_error_handler(error_handler); }
diff --git a/mojo/public/cpp/bindings/binding.h b/mojo/public/cpp/bindings/binding.h index 84b4f90d..8c9ee2f0 100644 --- a/mojo/public/cpp/bindings/binding.h +++ b/mojo/public/cpp/bindings/binding.h
@@ -7,11 +7,11 @@ #include <utility> +#include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/interface_ptr.h" #include "mojo/public/cpp/bindings/interface_ptr_info.h" #include "mojo/public/cpp/bindings/interface_request.h" @@ -212,7 +212,7 @@ // This method may only be called after this Binding has been bound to a // message pipe. The error handler will be reset when this Binding is unbound // or closed. - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { DCHECK(is_bound()); internal_state_.set_connection_error_handler(error_handler); }
diff --git a/mojo/public/cpp/bindings/binding_set.h b/mojo/public/cpp/bindings/binding_set.h index a22df5e..b1baca6 100644 --- a/mojo/public/cpp/bindings/binding_set.h +++ b/mojo/public/cpp/bindings/binding_set.h
@@ -10,6 +10,7 @@ #include <vector> #include "base/bind.h" +#include "base/callback.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/binding.h" @@ -24,7 +25,7 @@ BindingSet() {} ~BindingSet() { CloseAllBindings(); } - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { error_handler_ = error_handler; } @@ -66,7 +67,7 @@ ~Element() {} - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { error_handler_ = error_handler; } @@ -77,7 +78,7 @@ void Close() { binding_.Close(); } void OnConnectionError() { - Closure error_handler = error_handler_; + base::Closure error_handler = error_handler_; delete this; if (!error_handler.is_null()) error_handler.Run(); @@ -85,7 +86,7 @@ private: Binding<Interface> binding_; - Closure error_handler_; + base::Closure error_handler_; base::WeakPtrFactory<Element> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(Element); @@ -103,7 +104,7 @@ error_handler_.Run(); } - Closure error_handler_; + base::Closure error_handler_; std::vector<base::WeakPtr<Element>> bindings_; DISALLOW_COPY_AND_ASSIGN(BindingSet);
diff --git a/mojo/public/cpp/bindings/callback.h b/mojo/public/cpp/bindings/callback.h deleted file mode 100644 index f918d7d..0000000 --- a/mojo/public/cpp/bindings/callback.h +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_ -#define MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_ - -#include "base/callback.h" - -namespace mojo { - -template <typename Sig> -using Callback = base::Callback<Sig>; - -using Closure = base::Closure; - -} // namespace mojo - -#endif // MOJO_PUBLIC_CPP_BINDINGS_CALLBACK_H_
diff --git a/mojo/public/cpp/bindings/interface_ptr.h b/mojo/public/cpp/bindings/interface_ptr.h index 7bc8921..d894984 100644 --- a/mojo/public/cpp/bindings/interface_ptr.h +++ b/mojo/public/cpp/bindings/interface_ptr.h
@@ -8,12 +8,12 @@ #include <stdint.h> #include <utility> +#include "base/callback_forward.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/interface_ptr_info.h" #include "mojo/public/cpp/bindings/lib/interface_ptr_state.h" @@ -99,7 +99,7 @@ // Queries the max version that the remote side supports. On completion, the // result will be returned as the input of |callback|. The version number of // this interface pointer will also be updated. - void QueryVersion(const Callback<void(uint32_t)>& callback) { + void QueryVersion(const base::Callback<void(uint32_t)>& callback) { internal_state_.QueryVersion(callback); } @@ -147,7 +147,7 @@ // // This method may only be called after the InterfacePtr has been bound to a // message pipe. - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { internal_state_.set_connection_error_handler(error_handler); }
diff --git a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h index 8e015dcf..d5a965c 100644 --- a/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h +++ b/mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h
@@ -12,13 +12,13 @@ #include <utility> #include "base/bind.h" +#include "base/callback_forward.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "mojo/public/cpp/bindings/associated_group.h" #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" #include "mojo/public/cpp/bindings/lib/interface_endpoint_client.h" #include "mojo/public/cpp/bindings/lib/interface_id.h" @@ -51,7 +51,7 @@ return endpoint_client_->interface_id(); } - void QueryVersion(const Callback<void(uint32_t)>& callback) { + void QueryVersion(const base::Callback<void(uint32_t)>& callback) { // Do a static cast in case the interface contains methods with the same // name. It is safe to capture |this| because the callback won't be run // after this object goes away. @@ -108,7 +108,7 @@ return endpoint_client_ ? endpoint_client_->encountered_error() : false; } - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { DCHECK(endpoint_client_); endpoint_client_->set_connection_error_handler(error_handler); } @@ -125,7 +125,7 @@ private: using Proxy = typename Interface::Proxy_; - void OnQueryVersion(const Callback<void(uint32_t)>& callback, + void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, uint32_t version) { version_ = version; callback.Run(version);
diff --git a/mojo/public/cpp/bindings/lib/binding_state.h b/mojo/public/cpp/bindings/lib/binding_state.h index 6bea3a3..e74c7fd 100644 --- a/mojo/public/cpp/bindings/lib/binding_state.h +++ b/mojo/public/cpp/bindings/lib/binding_state.h
@@ -9,13 +9,13 @@ #include <utility> #include "base/bind.h" +#include "base/callback.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "mojo/public/cpp/bindings/associated_group.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/interface_ptr.h" #include "mojo/public/cpp/bindings/interface_ptr_info.h" #include "mojo/public/cpp/bindings/interface_request.h" @@ -95,7 +95,7 @@ return std::move(request); } - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { DCHECK(is_bound()); connection_error_handler_ = error_handler; } @@ -118,7 +118,7 @@ private: void DestroyRouter() { - router_->set_connection_error_handler(Closure()); + router_->set_connection_error_handler(base::Closure()); delete router_; router_ = nullptr; connection_error_handler_.Reset(); @@ -132,7 +132,7 @@ internal::Router* router_ = nullptr; typename Interface::Stub_ stub_; Interface* impl_; - Closure connection_error_handler_; + base::Closure connection_error_handler_; DISALLOW_COPY_AND_ASSIGN(BindingState); }; @@ -204,7 +204,7 @@ return request; } - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { DCHECK(is_bound()); connection_error_handler_ = error_handler; } @@ -238,7 +238,7 @@ typename Interface::Stub_ stub_; Interface* impl_; - Closure connection_error_handler_; + base::Closure connection_error_handler_; DISALLOW_COPY_AND_ASSIGN(BindingState); };
diff --git a/mojo/public/cpp/bindings/lib/connector.h b/mojo/public/cpp/bindings/lib/connector.h index 243159e..c47fa745 100644 --- a/mojo/public/cpp/bindings/lib/connector.h +++ b/mojo/public/cpp/bindings/lib/connector.h
@@ -7,11 +7,11 @@ #include <memory> +#include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_checker.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/lib/sync_handle_watcher.h" #include "mojo/public/cpp/bindings/message.h" #include "mojo/public/cpp/system/core.h" @@ -67,7 +67,7 @@ // Sets the error handler to receive notifications when an error is // encountered while reading from the pipe or waiting to read from the pipe. - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { DCHECK(thread_checker_.CalledOnValidThread()); connection_error_handler_ = error_handler; } @@ -173,7 +173,7 @@ void EnsureSyncWatcherExists(); - Closure connection_error_handler_; + base::Closure connection_error_handler_; ScopedMessagePipeHandle message_pipe_; MessageReceiver* incoming_receiver_;
diff --git a/mojo/public/cpp/bindings/lib/control_message_proxy.cc b/mojo/public/cpp/bindings/lib/control_message_proxy.cc index 219e04b..a22601c 100644 --- a/mojo/public/cpp/bindings/lib/control_message_proxy.cc +++ b/mojo/public/cpp/bindings/lib/control_message_proxy.cc
@@ -20,7 +20,7 @@ namespace { -using RunCallback = Callback<void(QueryVersionResultPtr)>; +using RunCallback = base::Callback<void(QueryVersionResultPtr)>; class RunResponseForwardToCallback : public MessageReceiver { public: @@ -88,7 +88,7 @@ ALLOW_UNUSED_LOCAL(ok); } -void RunVersionCallback(const Callback<void(uint32_t)>& callback, +void RunVersionCallback(const base::Callback<void(uint32_t)>& callback, QueryVersionResultPtr query_version_result) { callback.Run(query_version_result->version); } @@ -100,7 +100,7 @@ } void ControlMessageProxy::QueryVersion( - const Callback<void(uint32_t)>& callback) { + const base::Callback<void(uint32_t)>& callback) { SendRunMessage(receiver_, QueryVersion::New(), base::Bind(&RunVersionCallback, callback), &context_); }
diff --git a/mojo/public/cpp/bindings/lib/control_message_proxy.h b/mojo/public/cpp/bindings/lib/control_message_proxy.h index ce20fc8..5ec6ddc 100644 --- a/mojo/public/cpp/bindings/lib/control_message_proxy.h +++ b/mojo/public/cpp/bindings/lib/control_message_proxy.h
@@ -7,8 +7,8 @@ #include <stdint.h> +#include "base/callback_forward.h" #include "base/macros.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/lib/serialization_context.h" namespace mojo { @@ -23,7 +23,7 @@ // Doesn't take ownership of |receiver|. It must outlive this object. explicit ControlMessageProxy(MessageReceiverWithResponder* receiver); - void QueryVersion(const Callback<void(uint32_t)>& callback); + void QueryVersion(const base::Callback<void(uint32_t)>& callback); void RequireVersion(uint32_t version); protected:
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.h b/mojo/public/cpp/bindings/lib/interface_endpoint_client.h index 3f820db..8c72ff12c 100644 --- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.h +++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.h
@@ -10,13 +10,13 @@ #include <map> #include <memory> +#include "base/callback.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_checker.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/message.h" #include "mojo/public/cpp/bindings/message_filter.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" @@ -46,7 +46,7 @@ // Sets the error handler to receive notifications when an error is // encountered. - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { DCHECK(thread_checker_.CalledOnValidThread()); error_handler_ = error_handler; } @@ -139,7 +139,7 @@ uint64_t next_request_id_; - Closure error_handler_; + base::Closure error_handler_; bool encountered_error_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
diff --git a/mojo/public/cpp/bindings/lib/interface_ptr_state.h b/mojo/public/cpp/bindings/lib/interface_ptr_state.h index cf04a14..2aae4e6 100644 --- a/mojo/public/cpp/bindings/lib/interface_ptr_state.h +++ b/mojo/public/cpp/bindings/lib/interface_ptr_state.h
@@ -12,13 +12,13 @@ #include <utility> #include "base/bind.h" +#include "base/callback_forward.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" #include "mojo/public/cpp/bindings/associated_group.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/interface_ptr_info.h" #include "mojo/public/cpp/bindings/lib/control_message_proxy.h" #include "mojo/public/cpp/bindings/lib/filter_chain.h" @@ -61,7 +61,7 @@ uint32_t version() const { return version_; } - void QueryVersion(const Callback<void(uint32_t)>& callback) { + void QueryVersion(const base::Callback<void(uint32_t)>& callback) { ConfigureProxyIfNecessary(); // Do a static cast in case the interface contains methods with the same @@ -128,7 +128,7 @@ return router_ ? router_->encountered_error() : false; } - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { ConfigureProxyIfNecessary(); DCHECK(router_); @@ -170,7 +170,7 @@ proxy_ = new Proxy(router_); } - void OnQueryVersion(const Callback<void(uint32_t)>& callback, + void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, uint32_t version) { version_ = version; callback.Run(version); @@ -213,7 +213,7 @@ uint32_t version() const { return version_; } - void QueryVersion(const Callback<void(uint32_t)>& callback) { + void QueryVersion(const base::Callback<void(uint32_t)>& callback) { ConfigureProxyIfNecessary(); @@ -287,7 +287,7 @@ return endpoint_client_ ? endpoint_client_->encountered_error() : false; } - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { ConfigureProxyIfNecessary(); DCHECK(endpoint_client_); @@ -333,7 +333,7 @@ proxy_->serialization_context()->router = endpoint_client_->router(); } - void OnQueryVersion(const Callback<void(uint32_t)>& callback, + void OnQueryVersion(const base::Callback<void(uint32_t)>& callback, uint32_t version) { version_ = version; callback.Run(version);
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.h b/mojo/public/cpp/bindings/lib/multiplex_router.h index dbfd866..9f0de15 100644 --- a/mojo/public/cpp/bindings/lib/multiplex_router.h +++ b/mojo/public/cpp/bindings/lib/multiplex_router.h
@@ -20,7 +20,6 @@ #include "base/single_thread_task_runner.h" #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/lib/connector.h" #include "mojo/public/cpp/bindings/lib/interface_id.h" #include "mojo/public/cpp/bindings/lib/message_header_validator.h"
diff --git a/mojo/public/cpp/bindings/lib/router.h b/mojo/public/cpp/bindings/lib/router.h index 2f5e8e2a..4515a7e7 100644 --- a/mojo/public/cpp/bindings/lib/router.h +++ b/mojo/public/cpp/bindings/lib/router.h
@@ -11,12 +11,12 @@ #include <memory> #include <queue> +#include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_checker.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/lib/connector.h" #include "mojo/public/cpp/bindings/lib/filter_chain.h" @@ -41,7 +41,7 @@ // Sets the error handler to receive notifications when an error is // encountered while reading from the pipe or waiting to read from the pipe. - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { error_handler_ = error_handler; } @@ -166,7 +166,7 @@ // |pending_messages_|. bool pending_task_for_messages_; bool encountered_error_; - Closure error_handler_; + base::Closure error_handler_; base::ThreadChecker thread_checker_; base::WeakPtrFactory<Router> weak_factory_; };
diff --git a/mojo/public/cpp/bindings/lib/validation_errors.cc b/mojo/public/cpp/bindings/lib/validation_errors.cc index ea6aff8f..90652de 100644 --- a/mojo/public/cpp/bindings/lib/validation_errors.cc +++ b/mojo/public/cpp/bindings/lib/validation_errors.cc
@@ -89,7 +89,7 @@ } ValidationErrorObserverForTesting::ValidationErrorObserverForTesting( - const Callback<void()>& callback) + const base::Closure& callback) : last_error_(VALIDATION_ERROR_NONE), callback_(callback) { DCHECK(!g_validation_error_observer); g_validation_error_observer = this;
diff --git a/mojo/public/cpp/bindings/lib/validation_errors.h b/mojo/public/cpp/bindings/lib/validation_errors.h index d9dee37..ec0aa279 100644 --- a/mojo/public/cpp/bindings/lib/validation_errors.h +++ b/mojo/public/cpp/bindings/lib/validation_errors.h
@@ -5,9 +5,9 @@ #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ +#include "base/callback.h" #include "base/logging.h" #include "base/macros.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/lib/validation_context.h" namespace mojo { @@ -79,7 +79,7 @@ // validation. class ValidationErrorObserverForTesting { public: - explicit ValidationErrorObserverForTesting(const Callback<void()>& callback); + explicit ValidationErrorObserverForTesting(const base::Closure& callback); ~ValidationErrorObserverForTesting(); ValidationError last_error() const { return last_error_; } @@ -90,7 +90,7 @@ private: ValidationError last_error_; - Callback<void()> callback_; + base::Closure callback_; DISALLOW_COPY_AND_ASSIGN(ValidationErrorObserverForTesting); };
diff --git a/mojo/public/cpp/bindings/strong_binding.h b/mojo/public/cpp/bindings/strong_binding.h index 1116030..7ff2a0c 100644 --- a/mojo/public/cpp/bindings/strong_binding.h +++ b/mojo/public/cpp/bindings/strong_binding.h
@@ -8,10 +8,10 @@ #include <utility> #include "base/bind.h" +#include "base/callback.h" #include "base/logging.h" #include "base/macros.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/interface_ptr.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/lib/filter_chain.h" @@ -99,7 +99,7 @@ // // This method may only be called after this StrongBinding has been bound to a // message pipe. - void set_connection_error_handler(const Closure& error_handler) { + void set_connection_error_handler(const base::Closure& error_handler) { DCHECK(binding_.is_bound()); connection_error_handler_ = error_handler; } @@ -115,7 +115,7 @@ } private: - Closure connection_error_handler_; + base::Closure connection_error_handler_; Binding<Interface> binding_; DISALLOW_COPY_AND_ASSIGN(StrongBinding);
diff --git a/mojo/public/cpp/bindings/tests/BUILD.gn b/mojo/public/cpp/bindings/tests/BUILD.gn index 37bfd25..4e38f15 100644 --- a/mojo/public/cpp/bindings/tests/BUILD.gn +++ b/mojo/public/cpp/bindings/tests/BUILD.gn
@@ -47,7 +47,6 @@ deps = [ ":mojo_public_bindings_test_utils", "//mojo/public/cpp/bindings", - "//mojo/public/cpp/bindings:callback", "//mojo/public/cpp/system", "//mojo/public/cpp/test_support:test_utils", "//mojo/public/interfaces/bindings/tests:test_associated_interfaces", @@ -90,7 +89,6 @@ deps = [ "//mojo/public/cpp/bindings", - "//mojo/public/cpp/bindings:callback", "//mojo/public/cpp/system", "//mojo/public/interfaces/bindings/tests:test_interfaces", "//mojo/public/interfaces/bindings/tests:test_wtf_types", @@ -127,7 +125,6 @@ "//base/test:test_support", "//mojo/edk/test:test_support", "//mojo/public/cpp/bindings", - "//mojo/public/cpp/bindings:callback", "//mojo/public/cpp/system", "//mojo/public/cpp/test_support:test_utils", "//mojo/public/interfaces/bindings/tests:test_interfaces",
diff --git a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc index d7b826a2..e818969f 100644 --- a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc +++ b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/bind.h" +#include "base/callback.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/threading/thread.h" @@ -47,7 +48,7 @@ AssociatedBinding<IntegerSender>* binding() { return &binding_; } - void set_connection_error_handler(const Closure& handler) { + void set_connection_error_handler(const base::Closure& handler) { binding_.set_connection_error_handler(handler); }
diff --git a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc index 7cb782d..dab64f0 100644 --- a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc +++ b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/bind.h" +#include "base/callback.h" #include "base/message_loop/message_loop.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/lock.h" @@ -124,7 +125,7 @@ ~IntegerSenderImpl() override {} - using EchoHandler = Callback<void(int32_t, const EchoCallback&)>; + using EchoHandler = base::Callback<void(int32_t, const EchoCallback&)>; void set_echo_handler(const EchoHandler& handler) { echo_handler_ = handler; } @@ -157,7 +158,7 @@ ~IntegerSenderConnectionImpl() override {} - void set_get_sender_notification(const Closure& notification) { + void set_get_sender_notification(const base::Closure& notification) { get_sender_notification_ = notification; } void GetSender(IntegerSenderAssociatedRequest sender) override { @@ -177,7 +178,7 @@ Binding<IntegerSenderConnection> binding_; std::unique_ptr<SenderType> sender_impl_; scoped_refptr<base::SingleThreadTaskRunner> sender_runner_; - Closure get_sender_notification_; + base::Closure get_sender_notification_; }; class BindTaskRunnerTest : public testing::Test {
diff --git a/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc b/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc index 6f00d2e..0f438598e 100644 --- a/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc +++ b/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc
@@ -51,7 +51,7 @@ public: InterfaceImpl() : last_server_value_seen_(0), - callback_saved_(new Callback<void(int32_t)>()) {} + callback_saved_(new EchoIntCallback) {} ~InterfaceImpl() override { if (callback_saved_) { @@ -78,7 +78,7 @@ // sample::Provider implementation // Saves its two input values in member variables and does nothing else. - void EchoInt(int32_t x, const Callback<void(int32_t)>& callback) override { + void EchoInt(int32_t x, const EchoIntCallback& callback) override { last_server_value_seen_ = x; *callback_saved_ = callback; if (!closure_.is_null()) { @@ -88,24 +88,23 @@ } void EchoString(const String& a, - const Callback<void(String)>& callback) override { + const EchoStringCallback& callback) override { CHECK(false) << "Not implemented."; } void EchoStrings(const String& a, const String& b, - const Callback<void(String, String)>& callback) override { + const EchoStringsCallback& callback) override { CHECK(false) << "Not implemented."; } void EchoMessagePipeHandle( ScopedMessagePipeHandle a, - const Callback<void(ScopedMessagePipeHandle)>& callback) override { + const EchoMessagePipeHandleCallback& callback) override { CHECK(false) << "Not implemented."; } - void EchoEnum(sample::Enum a, - const Callback<void(sample::Enum)>& callback) override { + void EchoEnum(sample::Enum a, const EchoEnumCallback& callback) override { CHECK(false) << "Not implemented."; } @@ -117,7 +116,7 @@ private: int32_t last_server_value_seen_; - Callback<void(int32_t)>* callback_saved_; + EchoIntCallback* callback_saved_; base::Closure closure_; };
diff --git a/mojo/public/cpp/bindings/tests/bindings_perftest.cc b/mojo/public/cpp/bindings/tests/bindings_perftest.cc index 689ca2d..db0dd05f 100644 --- a/mojo/public/cpp/bindings/tests/bindings_perftest.cc +++ b/mojo/public/cpp/bindings/tests/bindings_perftest.cc
@@ -29,13 +29,13 @@ ~PingServiceImpl() override {} // |PingService| methods: - void Ping(const Callback<void()>& callback) override; + void Ping(const PingCallback& callback) override; private: DISALLOW_COPY_AND_ASSIGN(PingServiceImpl); }; -void PingServiceImpl::Ping(const Callback<void()>& callback) { +void PingServiceImpl::Ping(const PingCallback& callback) { callback.Run(); }
diff --git a/mojo/public/cpp/bindings/tests/connector_unittest.cc b/mojo/public/cpp/bindings/tests/connector_unittest.cc index 810ab8b8..0a81c9b8 100644 --- a/mojo/public/cpp/bindings/tests/connector_unittest.cc +++ b/mojo/public/cpp/bindings/tests/connector_unittest.cc
@@ -10,6 +10,8 @@ #include <utility> #include "base/bind.h" +#include "base/callback.h" +#include "base/callback_helpers.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/threading/thread_task_runner_handle.h" @@ -24,15 +26,13 @@ class MessageAccumulator : public MessageReceiver { public: MessageAccumulator() {} - explicit MessageAccumulator(const Closure& closure) : closure_(closure) {} + explicit MessageAccumulator(const base::Closure& closure) + : closure_(closure) {} bool Accept(Message* message) override { queue_.Push(message); - if (!closure_.is_null()) { - Closure closure = closure_; - closure_.Reset(); - closure.Run(); - } + if (!closure_.is_null()) + base::ResetAndReturn(&closure_).Run(); return true; } @@ -40,13 +40,13 @@ void Pop(Message* message) { queue_.Pop(message); } - void set_closure(const Closure& closure) { closure_ = closure; } + void set_closure(const base::Closure& closure) { closure_ = closure; } size_t size() const { return queue_.size(); } private: MessageQueue queue_; - Closure closure_; + base::Closure closure_; }; class ConnectorDeletingMessageAccumulator : public MessageAccumulator {
diff --git a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc index 549a974..9ab721f9 100644 --- a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc +++ b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
@@ -60,7 +60,7 @@ : binding_(this, std::move(request)) {} void SetName(const mojo::String& name) override { name_ = name; } - void GetName(const mojo::Callback<void(mojo::String)>& callback) override { + void GetName(const GetNameCallback& callback) override { callback.Run(name_); } @@ -141,12 +141,10 @@ // interfaces. void RequestImportedInterface( InterfaceRequest<imported::ImportedInterface> imported, - const mojo::Callback<void(InterfaceRequest<imported::ImportedInterface>)>& - callback) override {} + const RequestImportedInterfaceCallback& callback) override {} void TakeImportedInterface( imported::ImportedInterfacePtr imported, - const mojo::Callback<void(imported::ImportedInterfacePtr)>& callback) - override {} + const TakeImportedInterfaceCallback& callback) override {} private: ScopedMessagePipeHandle pipe1_;
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc index fd01a3f2..cf89897 100644 --- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc +++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -6,6 +6,7 @@ #include <utility> #include "base/bind.h" +#include "base/callback.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "mojo/public/cpp/bindings/binding.h" @@ -20,7 +21,7 @@ namespace test { namespace { -typedef mojo::Callback<void(double)> CalcCallback; +typedef base::Callback<void(double)> CalcCallback; class MathCalculatorImpl : public math::Calculator { public:
diff --git a/mojo/public/cpp/bindings/tests/request_response_unittest.cc b/mojo/public/cpp/bindings/tests/request_response_unittest.cc index cb944f7..2007ad76e 100644 --- a/mojo/public/cpp/bindings/tests/request_response_unittest.cc +++ b/mojo/public/cpp/bindings/tests/request_response_unittest.cc
@@ -23,8 +23,8 @@ : binding_(this, std::move(request)) {} void EchoString(const String& a, - const Callback<void(String)>& callback) override { - Callback<void(String)> callback_copy; + const EchoStringCallback& callback) override { + EchoStringCallback callback_copy; // Make sure operator= is used. callback_copy = callback; callback_copy.Run(a); @@ -32,18 +32,17 @@ void EchoStrings(const String& a, const String& b, - const Callback<void(String, String)>& callback) override { + const EchoStringsCallback& callback) override { callback.Run(a, b); } void EchoMessagePipeHandle( ScopedMessagePipeHandle a, - const Callback<void(ScopedMessagePipeHandle)>& callback) override { + const EchoMessagePipeHandleCallback& callback) override { callback.Run(std::move(a)); } - void EchoEnum(sample::Enum a, - const Callback<void(sample::Enum)>& callback) override { + void EchoEnum(sample::Enum a, const EchoEnumCallback& callback) override { callback.Run(a); }
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc index 10a8bda..ebfc073 100644 --- a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc +++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
@@ -38,57 +38,61 @@ public: TestSyncCommonImpl() {} - using PingHandler = Callback<void(const Callback<void()>&)>; - using PingBinder = LambdaBinder<const Callback<void()>&>; + using PingHandler = base::Callback<void(const base::Callback<void()>&)>; + using PingBinder = LambdaBinder<const base::Callback<void()>&>; template <typename Func> void set_ping_handler(Func handler) { ping_handler_ = PingBinder::BindLambda(handler); } - using EchoHandler = Callback<void(int32_t, const Callback<void(int32_t)>&)>; - using EchoBinder = LambdaBinder<int32_t, const Callback<void(int32_t)>&>; + using EchoHandler = + base::Callback<void(int32_t, const base::Callback<void(int32_t)>&)>; + using EchoBinder = + LambdaBinder<int32_t, const base::Callback<void(int32_t)>&>; template <typename Func> void set_echo_handler(Func handler) { echo_handler_ = EchoBinder::BindLambda(handler); } using AsyncEchoHandler = - Callback<void(int32_t, const Callback<void(int32_t)>&)>; - using AsyncEchoBinder = LambdaBinder<int32_t, const Callback<void(int32_t)>&>; + base::Callback<void(int32_t, const base::Callback<void(int32_t)>&)>; + using AsyncEchoBinder = + LambdaBinder<int32_t, const base::Callback<void(int32_t)>&>; template <typename Func> void set_async_echo_handler(Func handler) { async_echo_handler_ = AsyncEchoBinder::BindLambda(handler); } - using SendInterfaceHandler = Callback<void(TestSyncAssociatedPtrInfo)>; + using SendInterfaceHandler = base::Callback<void(TestSyncAssociatedPtrInfo)>; using SendInterfaceBinder = LambdaBinder<TestSyncAssociatedPtrInfo>; template <typename Func> void set_send_interface_handler(Func handler) { send_interface_handler_ = SendInterfaceBinder::BindLambda(handler); } - using SendRequestHandler = Callback<void(TestSyncAssociatedRequest)>; + using SendRequestHandler = base::Callback<void(TestSyncAssociatedRequest)>; using SendRequestBinder = LambdaBinder<TestSyncAssociatedRequest>; template <typename Func> void set_send_request_handler(Func handler) { send_request_handler_ = SendRequestBinder::BindLambda(handler); } - void PingImpl(const Callback<void()>& callback) { + void PingImpl(const base::Callback<void()>& callback) { if (ping_handler_.is_null()) { callback.Run(); return; } ping_handler_.Run(callback); } - void EchoImpl(int32_t value, const Callback<void(int32_t)>& callback) { + void EchoImpl(int32_t value, const base::Callback<void(int32_t)>& callback) { if (echo_handler_.is_null()) { callback.Run(value); return; } echo_handler_.Run(value, callback); } - void AsyncEchoImpl(int32_t value, const Callback<void(int32_t)>& callback) { + void AsyncEchoImpl(int32_t value, + const base::Callback<void(int32_t)>& callback) { if (async_echo_handler_.is_null()) { callback.Run(value); return;
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl index 35072806..c996adc 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl
@@ -17,7 +17,7 @@ {%- endmacro %} {%- macro declare_callback(method, for_blink) -%} -mojo::Callback<void( +base::Callback<void( {%- for param in method.response_parameters -%} {#- TODO(yzshen): For historical reasons, we use mojo::String here (instead of const mojo::String&) inconsistently. Preserve the behavior temporarily. #}
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl index fde39d7..b87e34c 100644 --- a/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl +++ b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -20,11 +20,11 @@ #include <type_traits> #include <utility> +#include "base/callback.h" #include "base/strings/string_piece.h" #include "mojo/public/cpp/bindings/associated_interface_ptr.h" #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h" #include "mojo/public/cpp/bindings/associated_interface_request.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/interface_ptr.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/lib/control_message_handler.h"
diff --git a/net/proxy/proxy_resolver_factory_mojo.cc b/net/proxy/proxy_resolver_factory_mojo.cc index e79db623..f831c52 100644 --- a/net/proxy/proxy_resolver_factory_mojo.cc +++ b/net/proxy/proxy_resolver_factory_mojo.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/bind.h" +#include "base/callback.h" #include "base/logging.h" #include "base/macros.h" #include "base/stl_util.h" @@ -353,8 +354,8 @@ private: void ReportResult(int32_t error) override { - resolver_ptr_.set_connection_error_handler(mojo::Closure()); - binding_.set_connection_error_handler(mojo::Closure()); + resolver_ptr_.set_connection_error_handler(base::Closure()); + binding_.set_connection_error_handler(base::Closure()); if (error == OK) { resolver_->reset(new ProxyResolverMojo( std::move(resolver_ptr_), factory_->host_resolver_,
diff --git a/services/shell/public/cpp/connection.h b/services/shell/public/cpp/connection.h index 74760ae75..22980a7 100644 --- a/services/shell/public/cpp/connection.h +++ b/services/shell/public/cpp/connection.h
@@ -10,6 +10,7 @@ #include <string> #include <utility> +#include "base/callback_forward.h" #include "base/memory/weak_ptr.h" #include "services/shell/public/cpp/connect.h" #include "services/shell/public/cpp/identity.h" @@ -134,7 +135,7 @@ // shell and remote metadata is available. Useful only for connections created // via Connector::Connect(). Once the connection is complete, metadata is // available immediately. - virtual void AddConnectionCompletedClosure(const mojo::Closure& callback) = 0; + virtual void AddConnectionCompletedClosure(const base::Closure& callback) = 0; // Returns true if the Shell allows |interface_name| to be exposed to the // remote application.
diff --git a/services/shell/public/cpp/lib/connection_impl.cc b/services/shell/public/cpp/lib/connection_impl.cc index 0be3d30..3a612e0 100644 --- a/services/shell/public/cpp/lib/connection_impl.cc +++ b/services/shell/public/cpp/lib/connection_impl.cc
@@ -85,7 +85,7 @@ } void ConnectionImpl::AddConnectionCompletedClosure( - const mojo::Closure& callback) { + const base::Closure& callback) { if (IsPending()) connection_completed_callbacks_.push_back(callback); else @@ -126,7 +126,7 @@ State::CONNECTED : State::DISCONNECTED; remote_id_ = target_application_id; remote_.set_user_id(target_user_id); - std::vector<mojo::Closure> callbacks; + std::vector<base::Closure> callbacks; callbacks.swap(connection_completed_callbacks_); for (auto callback : callbacks) callback.Run();
diff --git a/services/shell/public/cpp/lib/connection_impl.h b/services/shell/public/cpp/lib/connection_impl.h index 2cbcaa3..d8990f3 100644 --- a/services/shell/public/cpp/lib/connection_impl.h +++ b/services/shell/public/cpp/lib/connection_impl.h
@@ -10,6 +10,7 @@ #include <set> #include <string> +#include "base/callback.h" #include "mojo/public/cpp/bindings/binding.h" #include "services/shell/public/cpp/capabilities.h" #include "services/shell/public/cpp/connection.h" @@ -49,7 +50,7 @@ shell::mojom::ConnectResult GetResult() const override; bool IsPending() const override; uint32_t GetRemoteInstanceID() const override; - void AddConnectionCompletedClosure(const mojo::Closure& callback) override; + void AddConnectionCompletedClosure(const base::Closure& callback) override; bool AllowsInterface(const std::string& interface_name) const override; mojom::InterfaceProvider* GetRemoteInterfaceProvider() override; InterfaceRegistry* GetInterfaceRegistry() override; @@ -66,7 +67,7 @@ State state_; shell::mojom::ConnectResult result_ = shell::mojom::ConnectResult::SUCCEEDED; - std::vector<mojo::Closure> connection_completed_callbacks_; + std::vector<base::Closure> connection_completed_callbacks_; InterfaceRegistry interfaces_; RemoteInterfaceRegistry remote_interfaces_;
diff --git a/services/shell/public/cpp/shell_connection.h b/services/shell/public/cpp/shell_connection.h index f2f0cfc..59ed8f2 100644 --- a/services/shell/public/cpp/shell_connection.h +++ b/services/shell/public/cpp/shell_connection.h
@@ -13,7 +13,6 @@ #include "base/macros.h" #include "base/memory/scoped_vector.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/system/core.h" #include "services/shell/public/cpp/shell_client.h" #include "services/shell/public/interfaces/connector.mojom.h"
diff --git a/services/user/user_shell_client.cc b/services/user/user_shell_client.cc index d10e146..77cd850 100644 --- a/services/user/user_shell_client.cc +++ b/services/user/user_shell_client.cc
@@ -9,7 +9,6 @@ #include "base/memory/weak_ptr.h" #include "components/filesystem/lock_table.h" #include "components/leveldb/leveldb_service_impl.h" -#include "mojo/public/cpp/bindings/callback.h" #include "services/shell/public/cpp/connection.h" #include "services/user/user_id_map.h" #include "services/user/user_service.h"
diff --git a/services/user/user_shell_client.h b/services/user/user_shell_client.h index 205e416..25db9cef9 100644 --- a/services/user/user_shell_client.h +++ b/services/user/user_shell_client.h
@@ -5,6 +5,7 @@ #ifndef SERVICES_USER_USER_SHELL_CLIENT_H_ #define SERVICES_USER_USER_SHELL_CLIENT_H_ +#include "base/callback_forward.h" #include "base/memory/ref_counted.h" #include "components/filesystem/lock_table.h" #include "components/leveldb/public/interfaces/leveldb.mojom.h"
diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn index 0082b99..4ce70ea9 100644 --- a/third_party/WebKit/Source/platform/BUILD.gn +++ b/third_party/WebKit/Source/platform/BUILD.gn
@@ -361,7 +361,7 @@ deps = [ ":blink_common", "//components/link_header_util:link_header_util", - "//mojo/public/cpp/bindings:callback", + "//mojo/public/cpp/bindings", "//mojo/public/cpp/bindings:wtf_support", "//third_party/WebKit/Source/platform/heap", "//third_party/harfbuzz-ng",
diff --git a/third_party/WebKit/Source/platform/mojo/DEPS b/third_party/WebKit/Source/platform/mojo/DEPS index f612f8b..f62d157 100644 --- a/third_party/WebKit/Source/platform/mojo/DEPS +++ b/third_party/WebKit/Source/platform/mojo/DEPS
@@ -4,6 +4,5 @@ "+base/bind.h", "+base/message_loop/message_loop.h", "+mojo/public/cpp/bindings/binding.h", - "+mojo/public/cpp/bindings/callback.h", "+mojo/public/cpp/bindings/wtf_array.h", ]
diff --git a/third_party/WebKit/Source/platform/mojo/MojoHelper.h b/third_party/WebKit/Source/platform/mojo/MojoHelper.h index b43f902..cb37878 100644 --- a/third_party/WebKit/Source/platform/mojo/MojoHelper.h +++ b/third_party/WebKit/Source/platform/mojo/MojoHelper.h
@@ -6,7 +6,6 @@ #define MojoHelper_h #include "base/bind.h" -#include "mojo/public/cpp/bindings/callback.h" #include "mojo/public/cpp/bindings/wtf_array.h" #include "platform/heap/HeapAllocator.h" #include <utility>