Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: runtime/bin/eventhandler_fuchsia.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | runtime/bin/eventhandler_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/eventhandler_fuchsia.cc
diff --git a/runtime/bin/eventhandler_fuchsia.cc b/runtime/bin/eventhandler_fuchsia.cc
index 41feb5d03bac13297d393e58dee15a989307ef8d..41aa9cc908c3d71301e96edf61e4603190e1bbf0 100644
--- a/runtime/bin/eventhandler_fuchsia.cc
+++ b/runtime/bin/eventhandler_fuchsia.cc
@@ -97,7 +97,6 @@ intptr_t IOHandle::Read(void* buffer, intptr_t num_bytes) {
return read_bytes;
}
-
intptr_t IOHandle::Write(const void* buffer, intptr_t num_bytes) {
MutexLocker ml(mutex_);
const ssize_t written_bytes =
@@ -115,7 +114,6 @@ intptr_t IOHandle::Write(const void* buffer, intptr_t num_bytes) {
return written_bytes;
}
-
intptr_t IOHandle::Accept(struct sockaddr* addr, socklen_t* addrlen) {
MutexLocker ml(mutex_);
const intptr_t socket = NO_RETRY_EXPECTED(accept(fd_, addr, addrlen));
@@ -132,13 +130,11 @@ intptr_t IOHandle::Accept(struct sockaddr* addr, socklen_t* addrlen) {
return socket;
}
-
void IOHandle::Close() {
MutexLocker ml(mutex_);
VOID_NO_RETRY_EXPECTED(close(fd_));
}
-
uint32_t IOHandle::MaskToEpollEvents(intptr_t mask) {
MutexLocker ml(mutex_);
// Do not ask for POLLERR and POLLHUP explicitly as they are
@@ -153,7 +149,6 @@ uint32_t IOHandle::MaskToEpollEvents(intptr_t mask) {
return events;
}
-
intptr_t IOHandle::EpollEventsToMask(intptr_t events) {
if ((events & POLLERR) != 0) {
// Return error only if POLLIN is present.
@@ -172,7 +167,6 @@ intptr_t IOHandle::EpollEventsToMask(intptr_t events) {
return event_mask;
}
-
bool IOHandle::AsyncWaitLocked(mx_handle_t port,
uint32_t events,
uint64_t key) {
@@ -212,13 +206,11 @@ bool IOHandle::AsyncWaitLocked(mx_handle_t port,
return true;
}
-
bool IOHandle::AsyncWait(mx_handle_t port, uint32_t events, uint64_t key) {
MutexLocker ml(mutex_);
return AsyncWaitLocked(port, events, key);
}
-
void IOHandle::CancelWait(mx_handle_t port, uint64_t key) {
MutexLocker ml(mutex_);
LOG_INFO("IOHandle::CancelWait: fd = %ld\n", fd_);
@@ -230,7 +222,6 @@ void IOHandle::CancelWait(mx_handle_t port, uint64_t key) {
}
}
-
uint32_t IOHandle::WaitEnd(mx_signals_t observed) {
MutexLocker ml(mutex_);
uint32_t events = 0;
@@ -238,7 +229,6 @@ uint32_t IOHandle::WaitEnd(mx_signals_t observed) {
return events;
}
-
intptr_t IOHandle::ToggleEvents(intptr_t event_mask) {
MutexLocker ml(mutex_);
if (!write_events_enabled_) {
@@ -262,7 +252,6 @@ intptr_t IOHandle::ToggleEvents(intptr_t event_mask) {
return event_mask;
}
-
void EventHandlerImplementation::AddToPort(mx_handle_t port_handle,
DescriptorInfo* di) {
const uint32_t events = di->io_handle()->MaskToEpollEvents(di->Mask());
@@ -272,14 +261,12 @@ void EventHandlerImplementation::AddToPort(mx_handle_t port_handle,
}
}
-
void EventHandlerImplementation::RemoveFromPort(mx_handle_t port_handle,
DescriptorInfo* di) {
const uint64_t key = reinterpret_cast<uint64_t>(di);
di->io_handle()->CancelWait(port_handle, key);
}
-
EventHandlerImplementation::EventHandlerImplementation()
: socket_map_(&HashMap::SamePointerValue, 16) {
shutdown_ = false;
@@ -294,7 +281,6 @@ EventHandlerImplementation::EventHandlerImplementation()
ASSERT(port_handle_ != MX_HANDLE_INVALID);
}
-
static void DeleteDescriptorInfo(void* info) {
DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(info);
LOG_INFO("Closed %ld\n", di->io_handle()->fd());
@@ -302,14 +288,12 @@ static void DeleteDescriptorInfo(void* info) {
delete di;
}
-
EventHandlerImplementation::~EventHandlerImplementation() {
socket_map_.Clear(DeleteDescriptorInfo);
mx_handle_close(port_handle_);
port_handle_ = MX_HANDLE_INVALID;
}
-
void EventHandlerImplementation::UpdatePort(intptr_t old_mask,
DescriptorInfo* di) {
const intptr_t new_mask = di->Mask();
@@ -324,7 +308,6 @@ void EventHandlerImplementation::UpdatePort(intptr_t old_mask,
}
}
-
DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo(
intptr_t fd,
bool is_listening) {
@@ -349,7 +332,6 @@ DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo(
return di;
}
-
void EventHandlerImplementation::WakeupHandler(intptr_t id,
Dart_Port dart_port,
int64_t data) {
@@ -369,7 +351,6 @@ void EventHandlerImplementation::WakeupHandler(intptr_t id,
}
}
-
void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) {
if (msg->id == kTimerId) {
LOG_INFO("HandleInterrupt read timer update\n");
@@ -461,7 +442,6 @@ void EventHandlerImplementation::HandleInterrupt(InterruptMessage* msg) {
}
}
-
void EventHandlerImplementation::HandlePacket(mx_port_packet_t* pkt) {
LOG_INFO("HandlePacket: Got event packet: key=%lx\n", pkt->key);
LOG_INFO("HandlePacket: Got event packet: type=%lx\n", pkt->type);
@@ -499,7 +479,6 @@ void EventHandlerImplementation::HandlePacket(mx_port_packet_t* pkt) {
UpdatePort(old_mask, di);
}
-
int64_t EventHandlerImplementation::GetTimeout() const {
if (!timeout_queue_.HasTimeout()) {
return kInfinityTimeout;
@@ -509,7 +488,6 @@ int64_t EventHandlerImplementation::GetTimeout() const {
return (millis < 0) ? 0 : millis;
}
-
void EventHandlerImplementation::HandleTimeout() {
if (timeout_queue_.HasTimeout()) {
int64_t millis = timeout_queue_.CurrentTimeout() -
@@ -521,7 +499,6 @@ void EventHandlerImplementation::HandleTimeout() {
}
}
-
void EventHandlerImplementation::Poll(uword args) {
EventHandler* handler = reinterpret_cast<EventHandler*>(args);
EventHandlerImplementation* handler_impl = &handler->delegate_;
@@ -551,7 +528,6 @@ void EventHandlerImplementation::Poll(uword args) {
handler->NotifyShutdownDone();
}
-
void EventHandlerImplementation::Start(EventHandler* handler) {
int result = Thread::Start(&EventHandlerImplementation::Poll,
reinterpret_cast<uword>(handler));
@@ -560,12 +536,10 @@ void EventHandlerImplementation::Start(EventHandler* handler) {
}
}
-
void EventHandlerImplementation::Shutdown() {
SendData(kShutdownId, 0, 0);
}
-
void EventHandlerImplementation::SendData(intptr_t id,
Dart_Port dart_port,
int64_t data) {
@@ -577,7 +551,6 @@ void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) {
return reinterpret_cast<void*>(fd + 1);
}
-
uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
// The hashmap does not support keys with value 0.
return dart::Utils::WordHash(fd + 1);
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | runtime/bin/eventhandler_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698