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

Side by Side Diff: runtime/bin/eventhandler_android.cc

Issue 2229973002: Revert: Fixes memory leaks in the eventhandler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « runtime/bin/eventhandler.h ('k') | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #if defined(TARGET_OS_ANDROID) 8 #if defined(TARGET_OS_ANDROID)
9 9
10 #include "bin/eventhandler.h" 10 #include "bin/eventhandler.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, 111 int status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_,
112 EPOLL_CTL_ADD, 112 EPOLL_CTL_ADD,
113 interrupt_fds_[0], 113 interrupt_fds_[0],
114 &event)); 114 &event));
115 if (status == -1) { 115 if (status == -1) {
116 FATAL("Failed adding interrupt fd to epoll instance"); 116 FATAL("Failed adding interrupt fd to epoll instance");
117 } 117 }
118 } 118 }
119 119
120 120
121 static void DeleteDescriptorInfo(void* info) {
122 DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(info);
123 di->Close();
124 delete di;
125 }
126
127
128 EventHandlerImplementation::~EventHandlerImplementation() { 121 EventHandlerImplementation::~EventHandlerImplementation() {
129 socket_map_.Clear(DeleteDescriptorInfo);
130 VOID_TEMP_FAILURE_RETRY(close(epoll_fd_)); 122 VOID_TEMP_FAILURE_RETRY(close(epoll_fd_));
131 VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[0])); 123 VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[0]));
132 VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1])); 124 VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1]));
133 } 125 }
134 126
135 127
136 void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, 128 void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask,
137 DescriptorInfo *di) { 129 DescriptorInfo *di) {
138 intptr_t new_mask = di->Mask(); 130 intptr_t new_mask = di->Mask();
139 if ((old_mask != 0) && (new_mask == 0)) { 131 if ((old_mask != 0) && (new_mask == 0)) {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // The hashmap does not support keys with value 0. 430 // The hashmap does not support keys with value 0.
439 return dart::Utils::WordHash(fd + 1); 431 return dart::Utils::WordHash(fd + 1);
440 } 432 }
441 433
442 } // namespace bin 434 } // namespace bin
443 } // namespace dart 435 } // namespace dart
444 436
445 #endif // defined(TARGET_OS_ANDROID) 437 #endif // defined(TARGET_OS_ANDROID)
446 438
447 #endif // !defined(DART_IO_DISABLED) 439 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler.h ('k') | runtime/bin/eventhandler_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698