| Index: runtime/vm/port.cc
|
| diff --git a/runtime/vm/port.cc b/runtime/vm/port.cc
|
| index 20a142dd8262d5ff2078368bff3b6baf13cd652f..3bc03701fa6c0024c646585a6b905719cb9c99b1 100644
|
| --- a/runtime/vm/port.cc
|
| +++ b/runtime/vm/port.cc
|
| @@ -4,9 +4,9 @@
|
|
|
| #include "vm/port.h"
|
|
|
| -#include "vm/dart_entry.h"
|
| #include "platform/utils.h"
|
| #include "vm/dart_api_impl.h"
|
| +#include "vm/dart_entry.h"
|
| #include "vm/isolate.h"
|
| #include "vm/lockers.h"
|
| #include "vm/message_handler.h"
|
| @@ -22,7 +22,6 @@ intptr_t PortMap::used_ = 0;
|
| intptr_t PortMap::deleted_ = 0;
|
| Random* PortMap::prng_ = NULL;
|
|
|
| -
|
| intptr_t PortMap::FindPort(Dart_Port port) {
|
| // ILLEGAL_PORT (0) is used as a sentinel value in Entry.port. The loop below
|
| // could return the index to a deleted port when we are searching for
|
| @@ -47,7 +46,6 @@ intptr_t PortMap::FindPort(Dart_Port port) {
|
| return -1;
|
| }
|
|
|
| -
|
| void PortMap::Rehash(intptr_t new_capacity) {
|
| Entry* new_ports = new Entry[new_capacity];
|
| memset(new_ports, 0, new_capacity * sizeof(Entry));
|
| @@ -69,7 +67,6 @@ void PortMap::Rehash(intptr_t new_capacity) {
|
| deleted_ = 0;
|
| }
|
|
|
| -
|
| const char* PortMap::PortStateString(PortState kind) {
|
| switch (kind) {
|
| case kNewPort:
|
| @@ -84,7 +81,6 @@ const char* PortMap::PortStateString(PortState kind) {
|
| }
|
| }
|
|
|
| -
|
| Dart_Port PortMap::AllocatePort() {
|
| const Dart_Port kMASK = 0x3fffffff;
|
| Dart_Port result = prng_->NextUInt32() & kMASK;
|
| @@ -100,7 +96,6 @@ Dart_Port PortMap::AllocatePort() {
|
| return result;
|
| }
|
|
|
| -
|
| void PortMap::SetPortState(Dart_Port port, PortState state) {
|
| MutexLocker ml(mutex_);
|
| intptr_t index = FindPort(port);
|
| @@ -121,7 +116,6 @@ void PortMap::SetPortState(Dart_Port port, PortState state) {
|
| }
|
| }
|
|
|
| -
|
| void PortMap::MaintainInvariants() {
|
| intptr_t empty = capacity_ - used_ - deleted_;
|
| if (used_ > ((capacity_ / 4) * 3)) {
|
| @@ -134,7 +128,6 @@ void PortMap::MaintainInvariants() {
|
| }
|
| }
|
|
|
| -
|
| Dart_Port PortMap::CreatePort(MessageHandler* handler) {
|
| ASSERT(handler != NULL);
|
| MutexLocker ml(mutex_);
|
| @@ -185,7 +178,6 @@ Dart_Port PortMap::CreatePort(MessageHandler* handler) {
|
| return entry.port;
|
| }
|
|
|
| -
|
| bool PortMap::ClosePort(Dart_Port port) {
|
| MessageHandler* handler = NULL;
|
| {
|
| @@ -224,7 +216,6 @@ bool PortMap::ClosePort(Dart_Port port) {
|
| return true;
|
| }
|
|
|
| -
|
| void PortMap::ClosePorts(MessageHandler* handler) {
|
| {
|
| MutexLocker ml(mutex_);
|
| @@ -245,7 +236,6 @@ void PortMap::ClosePorts(MessageHandler* handler) {
|
| handler->CloseAllPorts();
|
| }
|
|
|
| -
|
| bool PortMap::PostMessage(Message* message) {
|
| MutexLocker ml(mutex_);
|
| intptr_t index = FindPort(message->dest_port());
|
| @@ -262,7 +252,6 @@ bool PortMap::PostMessage(Message* message) {
|
| return true;
|
| }
|
|
|
| -
|
| bool PortMap::IsLocalPort(Dart_Port id) {
|
| MutexLocker ml(mutex_);
|
| intptr_t index = FindPort(id);
|
| @@ -275,7 +264,6 @@ bool PortMap::IsLocalPort(Dart_Port id) {
|
| return handler->IsCurrentIsolate();
|
| }
|
|
|
| -
|
| Isolate* PortMap::GetIsolate(Dart_Port id) {
|
| MutexLocker ml(mutex_);
|
| intptr_t index = FindPort(id);
|
| @@ -288,7 +276,6 @@ Isolate* PortMap::GetIsolate(Dart_Port id) {
|
| return handler->isolate();
|
| }
|
|
|
| -
|
| void PortMap::InitOnce() {
|
| mutex_ = new Mutex();
|
| prng_ = new Random();
|
| @@ -303,7 +290,6 @@ void PortMap::InitOnce() {
|
| deleted_ = 0;
|
| }
|
|
|
| -
|
| void PortMap::PrintPortsForMessageHandler(MessageHandler* handler,
|
| JSONStream* stream) {
|
| #ifndef PRODUCT
|
| @@ -331,7 +317,6 @@ void PortMap::PrintPortsForMessageHandler(MessageHandler* handler,
|
| #endif
|
| }
|
|
|
| -
|
| void PortMap::DebugDumpForMessageHandler(MessageHandler* handler) {
|
| SafepointMutexLocker ml(mutex_);
|
| Object& msg_handler = Object::Handle();
|
| @@ -346,5 +331,4 @@ void PortMap::DebugDumpForMessageHandler(MessageHandler* handler) {
|
| }
|
| }
|
|
|
| -
|
| } // namespace dart
|
|
|