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

Side by Side Diff: runtime/bin/eventhandler_linux.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_android.cc ('k') | runtime/bin/eventhandler_macos.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_LINUX) 8 #if defined(TARGET_OS_LINUX)
9 9
10 #include "bin/eventhandler.h" 10 #include "bin/eventhandler.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 EPOLL_CTL_ADD, 120 EPOLL_CTL_ADD,
121 timer_fd_, 121 timer_fd_,
122 &event)); 122 &event));
123 if (status == -1) { 123 if (status == -1) {
124 FATAL2( 124 FATAL2(
125 "Failed adding timerfd fd(%i) to epoll instance: %i", timer_fd_, errno); 125 "Failed adding timerfd fd(%i) to epoll instance: %i", timer_fd_, errno);
126 } 126 }
127 } 127 }
128 128
129 129
130 static void DeleteDescriptorInfo(void* info) {
131 DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(info);
132 di->Close();
133 delete di;
134 }
135
136
137 EventHandlerImplementation::~EventHandlerImplementation() { 130 EventHandlerImplementation::~EventHandlerImplementation() {
138 socket_map_.Clear(DeleteDescriptorInfo);
139 VOID_TEMP_FAILURE_RETRY(close(epoll_fd_)); 131 VOID_TEMP_FAILURE_RETRY(close(epoll_fd_));
140 VOID_TEMP_FAILURE_RETRY(close(timer_fd_)); 132 VOID_TEMP_FAILURE_RETRY(close(timer_fd_));
141 VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[0])); 133 VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[0]));
142 VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1])); 134 VOID_TEMP_FAILURE_RETRY(close(interrupt_fds_[1]));
143 } 135 }
144 136
145 137
146 void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, 138 void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask,
147 DescriptorInfo *di) { 139 DescriptorInfo *di) {
148 intptr_t new_mask = di->Mask(); 140 intptr_t new_mask = di->Mask();
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // The hashmap does not support keys with value 0. 434 // The hashmap does not support keys with value 0.
443 return dart::Utils::WordHash(fd + 1); 435 return dart::Utils::WordHash(fd + 1);
444 } 436 }
445 437
446 } // namespace bin 438 } // namespace bin
447 } // namespace dart 439 } // namespace dart
448 440
449 #endif // defined(TARGET_OS_LINUX) 441 #endif // defined(TARGET_OS_LINUX)
450 442
451 #endif // !defined(DART_IO_DISABLED) 443 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/eventhandler_android.cc ('k') | runtime/bin/eventhandler_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698