Commit 18f6ea3c authored by Jeremy Manson's avatar Jeremy Manson Committed by Commit Bot

[Fuchsia] Migrate Chromium to new epitaph-friendly error handlers.

R=kmarshall@chromium.org, sky@chromium.org, wez@google.com

Bug: FIDL-319
Change-Id: I536f7cbaa670b439be621bcda8439a9d4597ee41
Reviewed-on: https://chromium-review.googlesource.com/c/1324918
Commit-Queue: Jeremy Manson <jeremymanson@google.com>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607740}
parent 357bef2f
...@@ -33,7 +33,7 @@ TEST_F(FilteredServiceDirectoryTest, Connect) { ...@@ -33,7 +33,7 @@ TEST_F(FilteredServiceDirectoryTest, Connect) {
auto stub = auto stub =
filtered_client_context_->ConnectToService<testfidl::TestInterface>(); filtered_client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, false); VerifyTestInterface(&stub, ZX_OK);
} }
// Verify that multiple connections to the same service work properly. // Verify that multiple connections to the same service work properly.
...@@ -44,15 +44,15 @@ TEST_F(FilteredServiceDirectoryTest, ConnectMultiple) { ...@@ -44,15 +44,15 @@ TEST_F(FilteredServiceDirectoryTest, ConnectMultiple) {
filtered_client_context_->ConnectToService<testfidl::TestInterface>(); filtered_client_context_->ConnectToService<testfidl::TestInterface>();
auto stub2 = auto stub2 =
filtered_client_context_->ConnectToService<testfidl::TestInterface>(); filtered_client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub1, false); VerifyTestInterface(&stub1, ZX_OK);
VerifyTestInterface(&stub2, false); VerifyTestInterface(&stub2, ZX_OK);
} }
// Verify that non-whitelisted services are blocked. // Verify that non-whitelisted services are blocked.
TEST_F(FilteredServiceDirectoryTest, ServiceBlocked) { TEST_F(FilteredServiceDirectoryTest, ServiceBlocked) {
auto stub = auto stub =
filtered_client_context_->ConnectToService<testfidl::TestInterface>(); filtered_client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, true); VerifyTestInterface(&stub, ZX_ERR_PEER_CLOSED);
} }
// Verify that FilteredServiceDirectory handles the case when the target service // Verify that FilteredServiceDirectory handles the case when the target service
...@@ -64,7 +64,7 @@ TEST_F(FilteredServiceDirectoryTest, NoService) { ...@@ -64,7 +64,7 @@ TEST_F(FilteredServiceDirectoryTest, NoService) {
auto stub = auto stub =
filtered_client_context_->ConnectToService<testfidl::TestInterface>(); filtered_client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, true); VerifyTestInterface(&stub, ZX_ERR_PEER_CLOSED);
} }
// Verify that FilteredServiceDirectory handles the case when the underlying // Verify that FilteredServiceDirectory handles the case when the underlying
...@@ -77,7 +77,7 @@ TEST_F(FilteredServiceDirectoryTest, NoServiceDir) { ...@@ -77,7 +77,7 @@ TEST_F(FilteredServiceDirectoryTest, NoServiceDir) {
auto stub = auto stub =
filtered_client_context_->ConnectToService<testfidl::TestInterface>(); filtered_client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, true); VerifyTestInterface(&stub, ZX_ERR_PEER_CLOSED);
} }
} // namespace fuchsia } // namespace fuchsia
......
...@@ -54,13 +54,13 @@ void ServiceDirectoryTestBase::ConnectClientContextToDirectory( ...@@ -54,13 +54,13 @@ void ServiceDirectoryTestBase::ConnectClientContextToDirectory(
void ServiceDirectoryTestBase::VerifyTestInterface( void ServiceDirectoryTestBase::VerifyTestInterface(
fidl::InterfacePtr<testfidl::TestInterface>* stub, fidl::InterfacePtr<testfidl::TestInterface>* stub,
bool expect_error) { zx_status_t expected_error) {
// Call the service and wait for response. // Call the service and wait for response.
base::RunLoop run_loop; base::RunLoop run_loop;
bool error = false; zx_status_t actual_error = ZX_OK;
stub->set_error_handler([&run_loop, &error]() { stub->set_error_handler([&run_loop, &actual_error](zx_status_t status) {
error = true; actual_error = status;
run_loop.Quit(); run_loop.Quit();
}); });
...@@ -71,11 +71,11 @@ void ServiceDirectoryTestBase::VerifyTestInterface( ...@@ -71,11 +71,11 @@ void ServiceDirectoryTestBase::VerifyTestInterface(
run_loop.Run(); run_loop.Run();
EXPECT_EQ(error, expect_error); EXPECT_EQ(expected_error, actual_error);
// Reset error handler because the current one captures |run_loop| and // Reset error handler because the current one captures |run_loop| and
// |error| references which are about to be destroyed. // |error| references which are about to be destroyed.
stub->set_error_handler([]() {}); stub->set_error_handler(nullptr);
} }
} // namespace fuchsia } // namespace fuchsia
......
...@@ -32,7 +32,7 @@ class ServiceDirectoryTestBase : public testing::Test { ...@@ -32,7 +32,7 @@ class ServiceDirectoryTestBase : public testing::Test {
void ConnectClientContextToDirectory(const char* path); void ConnectClientContextToDirectory(const char* path);
void VerifyTestInterface(fidl::InterfacePtr<testfidl::TestInterface>* stub, void VerifyTestInterface(fidl::InterfacePtr<testfidl::TestInterface>* stub,
bool expect_error); zx_status_t expected_error);
protected: protected:
MessageLoopForIO message_loop_; MessageLoopForIO message_loop_;
...@@ -47,4 +47,4 @@ class ServiceDirectoryTestBase : public testing::Test { ...@@ -47,4 +47,4 @@ class ServiceDirectoryTestBase : public testing::Test {
} // namespace fuchsia } // namespace fuchsia
} // namespace base } // namespace base
#endif // BASE_FUCHSIA_SERVICE_DIRECTORY_TEST_BASE_H_ #endif // BASE_FUCHSIA_SERVICE_DIRECTORY_TEST_BASE_H_
\ No newline at end of file
...@@ -27,7 +27,7 @@ class ServiceDirectoryTest : public ServiceDirectoryTestBase {}; ...@@ -27,7 +27,7 @@ class ServiceDirectoryTest : public ServiceDirectoryTestBase {};
// destroyed. // destroyed.
TEST_F(ServiceDirectoryTest, ConnectDisconnect) { TEST_F(ServiceDirectoryTest, ConnectDisconnect) {
auto stub = client_context_->ConnectToService<testfidl::TestInterface>(); auto stub = client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, false); VerifyTestInterface(&stub, ZX_OK);
base::RunLoop run_loop; base::RunLoop run_loop;
service_binding_->SetOnLastClientCallback(run_loop.QuitClosure()); service_binding_->SetOnLastClientCallback(run_loop.QuitClosure());
...@@ -50,15 +50,15 @@ TEST_F(ServiceDirectoryTest, ConnectDisconnect) { ...@@ -50,15 +50,15 @@ TEST_F(ServiceDirectoryTest, ConnectDisconnect) {
TEST_F(ServiceDirectoryTest, ConnectMulti) { TEST_F(ServiceDirectoryTest, ConnectMulti) {
auto stub = client_context_->ConnectToService<testfidl::TestInterface>(); auto stub = client_context_->ConnectToService<testfidl::TestInterface>();
auto stub2 = client_context_->ConnectToService<testfidl::TestInterface>(); auto stub2 = client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, false); VerifyTestInterface(&stub, ZX_OK);
VerifyTestInterface(&stub2, false); VerifyTestInterface(&stub2, ZX_OK);
} }
// Verify that services are also exported to the legacy flat service namespace. // Verify that services are also exported to the legacy flat service namespace.
TEST_F(ServiceDirectoryTest, ConnectLegacy) { TEST_F(ServiceDirectoryTest, ConnectLegacy) {
ConnectClientContextToDirectory("."); ConnectClientContextToDirectory(".");
auto stub = client_context_->ConnectToService<testfidl::TestInterface>(); auto stub = client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, false); VerifyTestInterface(&stub, ZX_OK);
} }
// Verify that ComponentContext can handle the case when the service directory // Verify that ComponentContext can handle the case when the service directory
...@@ -72,14 +72,14 @@ TEST_F(ServiceDirectoryTest, DirectoryGone) { ...@@ -72,14 +72,14 @@ TEST_F(ServiceDirectoryTest, DirectoryGone) {
client_context_->ConnectToService(FidlInterfaceRequest(&stub)); client_context_->ConnectToService(FidlInterfaceRequest(&stub));
EXPECT_EQ(status, ZX_ERR_PEER_CLOSED); EXPECT_EQ(status, ZX_ERR_PEER_CLOSED);
VerifyTestInterface(&stub, true); VerifyTestInterface(&stub, ZX_ERR_PEER_CLOSED);
} }
// Verify that the case when the service doesn't exist is handled properly. // Verify that the case when the service doesn't exist is handled properly.
TEST_F(ServiceDirectoryTest, NoService) { TEST_F(ServiceDirectoryTest, NoService) {
service_binding_.reset(); service_binding_.reset();
auto stub = client_context_->ConnectToService<testfidl::TestInterface>(); auto stub = client_context_->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, true); VerifyTestInterface(&stub, ZX_ERR_PEER_CLOSED);
} }
} // namespace fuchsia } // namespace fuchsia
......
...@@ -56,7 +56,7 @@ bool MixerOutputStreamFuchsia::Start(int requested_sample_rate, int channels) { ...@@ -56,7 +56,7 @@ bool MixerOutputStreamFuchsia::Start(int requested_sample_rate, int channels) {
->ConnectToService<fuchsia::media::Audio>(); ->ConnectToService<fuchsia::media::Audio>();
audio_server->CreateAudioRenderer(audio_renderer_.NewRequest()); audio_server->CreateAudioRenderer(audio_renderer_.NewRequest());
audio_renderer_.set_error_handler( audio_renderer_.set_error_handler(
fit::bind_member(this, &MixerOutputStreamFuchsia::OnRendererError)); [this](zx_status_t status) { this->OnRendererError(status); });
// Configure the renderer. // Configure the renderer.
fuchsia::media::AudioStreamType format; fuchsia::media::AudioStreamType format;
...@@ -202,8 +202,8 @@ base::TimeTicks MixerOutputStreamFuchsia::GetCurrentStreamTime() { ...@@ -202,8 +202,8 @@ base::TimeTicks MixerOutputStreamFuchsia::GetCurrentStreamTime() {
stream_position_samples_, sample_rate_); stream_position_samples_, sample_rate_);
} }
void MixerOutputStreamFuchsia::OnRendererError() { void MixerOutputStreamFuchsia::OnRendererError(zx_status_t status) {
LOG(WARNING) << "AudioRenderer has failed."; LOG(WARNING) << "AudioRenderer has failed with code " << status;
Stop(); Stop();
} }
......
...@@ -38,7 +38,7 @@ class MixerOutputStreamFuchsia : public MixerOutputStream { ...@@ -38,7 +38,7 @@ class MixerOutputStreamFuchsia : public MixerOutputStream {
base::TimeTicks GetCurrentStreamTime(); base::TimeTicks GetCurrentStreamTime();
// Event handlers for |audio_renderer_|. // Event handlers for |audio_renderer_|.
void OnRendererError(); void OnRendererError(zx_status_t status);
void OnMinLeadTimeChanged(int64_t min_lead_time); void OnMinLeadTimeChanged(int64_t min_lead_time);
int sample_rate_ = 0; int sample_rate_ = 0;
......
...@@ -145,7 +145,7 @@ void AudioOutputStreamFuchsia::OnMinLeadTimeChanged(int64_t min_lead_time) { ...@@ -145,7 +145,7 @@ void AudioOutputStreamFuchsia::OnMinLeadTimeChanged(int64_t min_lead_time) {
} }
} }
void AudioOutputStreamFuchsia::OnRendererError() { void AudioOutputStreamFuchsia::OnRendererError(zx_status_t status) {
LOG(WARNING) << "AudioRenderer has failed."; LOG(WARNING) << "AudioRenderer has failed.";
ReportError(); ReportError();
} }
......
...@@ -45,7 +45,7 @@ class AudioOutputStreamFuchsia : public AudioOutputStream { ...@@ -45,7 +45,7 @@ class AudioOutputStreamFuchsia : public AudioOutputStream {
void OnMinLeadTimeChanged(int64_t min_lead_time); void OnMinLeadTimeChanged(int64_t min_lead_time);
// Error handler for |audio_out_|. // Error handler for |audio_out_|.
void OnRendererError(); void OnRendererError(zx_status_t status);
// Resets internal state and reports an error to |callback_|. // Resets internal state and reports an error to |callback_|.
void ReportError(); void ReportError();
......
...@@ -411,10 +411,12 @@ void FuchsiaVideoDecoder::Initialize( ...@@ -411,10 +411,12 @@ void FuchsiaVideoDecoder::Initialize(
->ConnectToService<fuchsia::mediacodec::CodecFactory>(); ->ConnectToService<fuchsia::mediacodec::CodecFactory>();
codec_factory->CreateDecoder(std::move(codec_params), codec_.NewRequest()); codec_factory->CreateDecoder(std::move(codec_params), codec_.NewRequest());
codec_.set_error_handler([this]() { codec_.set_error_handler(
LOG(ERROR) << "The fuchsia.mediacodec.Codec channel was terminated."; [this](zx_status_t status) {
OnError(); ZX_LOG(ERROR, status)
}); << "The fuchsia.mediacodec.Codec channel was terminated.";
OnError();
});
codec_.events().OnStreamFailed = codec_.events().OnStreamFailed =
fit::bind_member(this, &FuchsiaVideoDecoder::OnStreamFailed); fit::bind_member(this, &FuchsiaVideoDecoder::OnStreamFailed);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <vector> #include <vector>
#include "base/fuchsia/component_context.h" #include "base/fuchsia/component_context.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "net/base/network_interfaces.h" #include "net/base/network_interfaces.h"
...@@ -46,8 +47,9 @@ NetworkChangeNotifierFuchsia::NetworkChangeNotifierFuchsia( ...@@ -46,8 +47,9 @@ NetworkChangeNotifierFuchsia::NetworkChangeNotifierFuchsia(
: netstack_(std::move(netstack)) { : netstack_(std::move(netstack)) {
DCHECK(netstack_); DCHECK(netstack_);
netstack_.set_error_handler( netstack_.set_error_handler([](zx_status_t status) {
[]() { LOG(ERROR) << "Lost connection to netstack."; }); ZX_LOG(ERROR, status) << "Lost connection to netstack.";
});
netstack_.events().OnInterfacesChanged = netstack_.events().OnInterfacesChanged =
[this](fidl::VectorPtr<fuchsia::netstack::NetInterface> interfaces) { [this](fidl::VectorPtr<fuchsia::netstack::NetInterface> interfaces) {
ProcessInterfaceList(base::OnceClosure(), std::move(interfaces)); ProcessInterfaceList(base::OnceClosure(), std::move(interfaces));
......
...@@ -28,7 +28,7 @@ InputMethodKeyboardControllerFuchsia::InputMethodKeyboardControllerFuchsia( ...@@ -28,7 +28,7 @@ InputMethodKeyboardControllerFuchsia::InputMethodKeyboardControllerFuchsia(
DCHECK(ime_service_); DCHECK(ime_service_);
DCHECK(input_method_); DCHECK(input_method_);
ime_service_.set_error_handler([this]() { ime_service_.set_error_handler([this](zx_status_t status) {
LOG(ERROR) << "Lost connection to IME service."; LOG(ERROR) << "Lost connection to IME service.";
ime_.Unbind(); ime_.Unbind();
ime_client_binding_.Unbind(); ime_client_binding_.Unbind();
......
...@@ -221,8 +221,8 @@ void ScenicWindow::OnPropertiesChanged( ...@@ -221,8 +221,8 @@ void ScenicWindow::OnPropertiesChanged(
callback(); callback();
} }
void ScenicWindow::OnScenicError() { void ScenicWindow::OnScenicError(zx_status_t status) {
LOG(ERROR) << "scenic::Session failed."; LOG(ERROR) << "scenic::Session failed with code " << status << ".";
delegate_->OnClosed(); delegate_->OnClosed();
} }
...@@ -273,8 +273,8 @@ void ScenicWindow::OnEvent(fuchsia::ui::input::InputEvent event, ...@@ -273,8 +273,8 @@ void ScenicWindow::OnEvent(fuchsia::ui::input::InputEvent event,
callback(result); callback(result);
} }
void ScenicWindow::OnViewError() { void ScenicWindow::OnViewError(zx_status_t status) {
VLOG(1) << "viewsv1::View connection was closed."; VLOG(1) << "viewsv1::View connection was closed with code " << status << ".";
delegate_->OnClosed(); delegate_->OnClosed();
} }
......
...@@ -80,7 +80,7 @@ class OZONE_EXPORT ScenicWindow : public PlatformWindow, ...@@ -80,7 +80,7 @@ class OZONE_EXPORT ScenicWindow : public PlatformWindow,
OnEventCallback callback) override; OnEventCallback callback) override;
// Callbacks for |scenic_session_|. // Callbacks for |scenic_session_|.
void OnScenicError(); void OnScenicError(zx_status_t status);
void OnScenicEvents(fidl::VectorPtr<fuchsia::ui::scenic::Event> events); void OnScenicEvents(fidl::VectorPtr<fuchsia::ui::scenic::Event> events);
// InputEventDispatcher::Delegate interface. // InputEventDispatcher::Delegate interface.
...@@ -88,7 +88,7 @@ class OZONE_EXPORT ScenicWindow : public PlatformWindow, ...@@ -88,7 +88,7 @@ class OZONE_EXPORT ScenicWindow : public PlatformWindow,
// Error handler for |view_|. This error normally indicates the View was // Error handler for |view_|. This error normally indicates the View was
// destroyed (e.g. dropping ViewOwner). // destroyed (e.g. dropping ViewOwner).
void OnViewError(); void OnViewError(zx_status_t status);
void UpdateSize(); void UpdateSize();
......
...@@ -23,8 +23,10 @@ fuchsia::ui::viewsv1::ViewManager* ScenicWindowManager::GetViewManager() { ...@@ -23,8 +23,10 @@ fuchsia::ui::viewsv1::ViewManager* ScenicWindowManager::GetViewManager() {
if (!view_manager_) { if (!view_manager_) {
view_manager_ = base::fuchsia::ComponentContext::GetDefault() view_manager_ = base::fuchsia::ComponentContext::GetDefault()
->ConnectToService<fuchsia::ui::viewsv1::ViewManager>(); ->ConnectToService<fuchsia::ui::viewsv1::ViewManager>();
view_manager_.set_error_handler([]() { view_manager_.set_error_handler([](zx_status_t status) {
LOG(ERROR) << "The ViewManager channel was unexpectedly terminated."; LOG(ERROR)
<< "The ViewManager channel was unexpectedly terminated with status "
<< status << ".";
}); });
} }
...@@ -35,7 +37,7 @@ fuchsia::ui::scenic::Scenic* ScenicWindowManager::GetScenic() { ...@@ -35,7 +37,7 @@ fuchsia::ui::scenic::Scenic* ScenicWindowManager::GetScenic() {
if (!scenic_) { if (!scenic_) {
scenic_ = base::fuchsia::ComponentContext::GetDefault() scenic_ = base::fuchsia::ComponentContext::GetDefault()
->ConnectToService<fuchsia::ui::scenic::Scenic>(); ->ConnectToService<fuchsia::ui::scenic::Scenic>();
scenic_.set_error_handler([]() { scenic_.set_error_handler([](zx_status_t status) {
LOG(ERROR) << "The Scenic channel was unexpectedly terminated."; LOG(ERROR) << "The Scenic channel was unexpectedly terminated.";
}); });
} }
......
...@@ -49,7 +49,7 @@ WebComponent::WebComponent( ...@@ -49,7 +49,7 @@ WebComponent::WebComponent(
// to destroy this component on error. // to destroy this component on error.
if (controller_request.is_valid()) { if (controller_request.is_valid()) {
controller_binding_.Bind(std::move(controller_request)); controller_binding_.Bind(std::move(controller_request));
controller_binding_.set_error_handler([this] { controller_binding_.set_error_handler([this](zx_status_t status) {
// Signal graceful process termination. // Signal graceful process termination.
DestroyComponent(0, fuchsia::sys::TerminationReason::EXITED); DestroyComponent(0, fuchsia::sys::TerminationReason::EXITED);
}); });
......
...@@ -37,7 +37,7 @@ chromium::web::ContextPtr WebContentRunner::CreateDefaultWebContext() { ...@@ -37,7 +37,7 @@ chromium::web::ContextPtr WebContentRunner::CreateDefaultWebContext() {
chromium::web::ContextPtr web_context; chromium::web::ContextPtr web_context;
web_context_provider->Create(std::move(create_params), web_context_provider->Create(std::move(create_params),
web_context.NewRequest()); web_context.NewRequest());
web_context.set_error_handler([]() { web_context.set_error_handler([](zx_status_t status) {
// If the browser instance died, then exit everything and do not attempt // If the browser instance died, then exit everything and do not attempt
// to recover. appmgr will relaunch the runner when it is needed again. // to recover. appmgr will relaunch the runner when it is needed again.
LOG(ERROR) << "Connection to Context lost."; LOG(ERROR) << "Connection to Context lost.";
......
...@@ -161,7 +161,8 @@ FrameImpl::FrameImpl(std::unique_ptr<content::WebContents> web_contents, ...@@ -161,7 +161,8 @@ FrameImpl::FrameImpl(std::unique_ptr<content::WebContents> web_contents,
binding_(this, std::move(frame_request)) { binding_(this, std::move(frame_request)) {
web_contents_->SetDelegate(this); web_contents_->SetDelegate(this);
Observe(web_contents_.get()); Observe(web_contents_.get());
binding_.set_error_handler([this]() { context_->DestroyFrame(this); }); binding_.set_error_handler(
[this](zx_status_t status) { context_->DestroyFrame(this); });
} }
FrameImpl::~FrameImpl() { FrameImpl::~FrameImpl() {
...@@ -317,9 +318,8 @@ void FrameImpl::SetNavigationEventObserver( ...@@ -317,9 +318,8 @@ void FrameImpl::SetNavigationEventObserver(
if (observer) { if (observer) {
navigation_observer_.Bind(std::move(observer)); navigation_observer_.Bind(std::move(observer));
navigation_observer_.set_error_handler([this]() { navigation_observer_.set_error_handler(
SetNavigationEventObserver(nullptr); [this](zx_status_t status) { SetNavigationEventObserver(nullptr); });
});
} else { } else {
navigation_observer_.Unbind(); navigation_observer_.Unbind();
} }
......
...@@ -145,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(FrameImplTest, ContextDeletedBeforeFrame) { ...@@ -145,7 +145,7 @@ IN_PROC_BROWSER_TEST_F(FrameImplTest, ContextDeletedBeforeFrame) {
EXPECT_TRUE(frame); EXPECT_TRUE(frame);
base::RunLoop run_loop; base::RunLoop run_loop;
frame.set_error_handler([&run_loop]() { run_loop.Quit(); }); frame.set_error_handler([&run_loop](zx_status_t status) { run_loop.Quit(); });
context().Unbind(); context().Unbind();
run_loop.Run(); run_loop.Run();
EXPECT_FALSE(frame); EXPECT_FALSE(frame);
......
...@@ -51,7 +51,7 @@ void WebRunnerBrowserMainParts::PreMainMessageLoopRun() { ...@@ -51,7 +51,7 @@ void WebRunnerBrowserMainParts::PreMainMessageLoopRun() {
std::move(context_channel_))); std::move(context_channel_)));
// Quit the browser main loop when the Context connection is dropped. // Quit the browser main loop when the Context connection is dropped.
context_binding_->set_error_handler([this]() { context_binding_->set_error_handler([this](zx_status_t status) {
DLOG(WARNING) << "Client connection to Context service dropped."; DLOG(WARNING) << "Client connection to Context service dropped.";
context_service_.reset(); context_service_.reset();
std::move(quit_closure_).Run(); std::move(quit_closure_).Run();
......
...@@ -56,7 +56,8 @@ class HttpServiceTest : public ::testing::Test { ...@@ -56,7 +56,8 @@ class HttpServiceTest : public ::testing::Test {
void TearDown() override { void TearDown() override {
// Disconnect the client and wait for the service to shut down. // Disconnect the client and wait for the service to shut down.
base::RunLoop run_loop; base::RunLoop run_loop;
binding_.set_error_handler([&run_loop]() { run_loop.Quit(); }); binding_.set_error_handler(
[&run_loop](zx_status_t status) { run_loop.Quit(); });
http_service_interface_.Unbind(); http_service_interface_.Unbind();
run_loop.Run(); run_loop.Run();
binding_.set_error_handler(nullptr); binding_.set_error_handler(nullptr);
......
...@@ -124,7 +124,7 @@ URLLoaderImpl::URLLoaderImpl(std::unique_ptr<net::URLRequestContext> context, ...@@ -124,7 +124,7 @@ URLLoaderImpl::URLLoaderImpl(std::unique_ptr<net::URLRequestContext> context,
context_(std::move(context)), context_(std::move(context)),
buffer_(new net::GrowableIOBuffer()), buffer_(new net::GrowableIOBuffer()),
write_watch_(FROM_HERE) { write_watch_(FROM_HERE) {
binding_.set_error_handler([this] { delete this; }); binding_.set_error_handler([this](zx_status_t status) { delete this; });
g_active_requests++; g_active_requests++;
} }
...@@ -429,4 +429,4 @@ oldhttp::URLResponse URLLoaderImpl::BuildResponse(int net_error) { ...@@ -429,4 +429,4 @@ oldhttp::URLResponse URLLoaderImpl::BuildResponse(int net_error) {
return response; return response;
} }
} // namespace net_http } // namespace net_http
\ No newline at end of file
...@@ -44,7 +44,7 @@ class FakeFrame : public chromium::web::Frame { ...@@ -44,7 +44,7 @@ class FakeFrame : public chromium::web::Frame {
public: public:
explicit FakeFrame(fidl::InterfaceRequest<chromium::web::Frame> request) explicit FakeFrame(fidl::InterfaceRequest<chromium::web::Frame> request)
: binding_(this, std::move(request)) { : binding_(this, std::move(request)) {
binding_.set_error_handler([this]() { delete this; }); binding_.set_error_handler([this](zx_status_t status) { delete this; });
} }
~FakeFrame() override = default; ~FakeFrame() override = default;
...@@ -157,7 +157,8 @@ MULTIPROCESS_TEST_MAIN(SpawnContextServer) { ...@@ -157,7 +157,8 @@ MULTIPROCESS_TEST_MAIN(SpawnContextServer) {
// Quit the process when the context is destroyed. // Quit the process when the context is destroyed.
base::RunLoop run_loop; base::RunLoop run_loop;
context_binding.set_error_handler([&run_loop]() { run_loop.Quit(); }); context_binding.set_error_handler(
[&run_loop](zx_status_t status) { run_loop.Quit(); });
run_loop.Run(); run_loop.Run();
return 0; return 0;
...@@ -184,13 +185,13 @@ class ContextProviderImplTest : public base::MultiProcessTest { ...@@ -184,13 +185,13 @@ class ContextProviderImplTest : public base::MultiProcessTest {
fidl::InterfacePtr<chromium::web::Context>* context) { fidl::InterfacePtr<chromium::web::Context>* context) {
// Call a Context method and wait for it to invoke an observer call. // Call a Context method and wait for it to invoke an observer call.
base::RunLoop run_loop; base::RunLoop run_loop;
context->set_error_handler([&run_loop]() { context->set_error_handler([&run_loop](zx_status_t status) {
ADD_FAILURE(); ADD_FAILURE();
run_loop.Quit(); run_loop.Quit();
}); });
chromium::web::FramePtr frame_ptr; chromium::web::FramePtr frame_ptr;
frame_ptr.set_error_handler([&run_loop]() { frame_ptr.set_error_handler([&run_loop](zx_status_t status) {
ADD_FAILURE(); ADD_FAILURE();
run_loop.Quit(); run_loop.Quit();
}); });
...@@ -225,7 +226,8 @@ class ContextProviderImplTest : public base::MultiProcessTest { ...@@ -225,7 +226,8 @@ class ContextProviderImplTest : public base::MultiProcessTest {
void CheckContextUnresponsive( void CheckContextUnresponsive(
fidl::InterfacePtr<chromium::web::Context>* context) { fidl::InterfacePtr<chromium::web::Context>* context) {
base::RunLoop run_loop; base::RunLoop run_loop;
context->set_error_handler([&run_loop]() { run_loop.Quit(); }); context->set_error_handler(
[&run_loop](zx_status_t status) { run_loop.Quit(); });
chromium::web::FramePtr frame; chromium::web::FramePtr frame;
(*context)->CreateFrame(frame.NewRequest()); (*context)->CreateFrame(frame.NewRequest());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment