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

Side by Side Diff: chromeos/network/firewall_hole.cc

Issue 1074963003: Clean up potentially leaky use of base::DeletePointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed another probleb Created 5 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/network/firewall_hole.h" 5 #include "chromeos/network/firewall_hole.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 LOG(WARNING) << "Failed to release firewall hole for " 56 LOG(WARNING) << "Failed to release firewall hole for "
57 << PortTypeToString(type) << " port " << port << " on " 57 << PortTypeToString(type) << " port " << port << " on "
58 << interface << "."; 58 << interface << ".";
59 } 59 }
60 } 60 }
61 61
62 } // namespace 62 } // namespace
63 63
64 void CHROMEOS_EXPORT FirewallHole::FileDescriptorDeleter::operator()( 64 void CHROMEOS_EXPORT FirewallHole::FileDescriptorDeleter::operator()(
65 dbus::FileDescriptor* fd) { 65 dbus::FileDescriptor* fd) {
66 scoped_ptr<dbus::FileDescriptor> owned_fd(fd);
66 base::WorkerPool::PostTask( 67 base::WorkerPool::PostTask(
67 FROM_HERE, base::Bind(&base::DeletePointer<dbus::FileDescriptor>, fd), 68 FROM_HERE, base::Bind(&base::DeletePointer<dbus::FileDescriptor>,
69 base::Passed(&owned_fd)),
68 false); 70 false);
69 } 71 }
70 72
71 // static 73 // static
72 void FirewallHole::Open(PortType type, 74 void FirewallHole::Open(PortType type,
73 uint16_t port, 75 uint16_t port,
74 const std::string& interface, 76 const std::string& interface,
75 const OpenCallback& callback) { 77 const OpenCallback& callback) {
76 ScopedFileDescriptor lifeline_local(new dbus::FileDescriptor()); 78 ScopedFileDescriptor lifeline_local(new dbus::FileDescriptor());
77 ScopedFileDescriptor lifeline_remote(new dbus::FileDescriptor()); 79 ScopedFileDescriptor lifeline_remote(new dbus::FileDescriptor());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 uint16_t port, 157 uint16_t port,
156 const std::string& interface, 158 const std::string& interface,
157 ScopedFileDescriptor lifeline_fd) 159 ScopedFileDescriptor lifeline_fd)
158 : type_(type), 160 : type_(type),
159 port_(port), 161 port_(port),
160 interface_(interface), 162 interface_(interface),
161 lifeline_fd_(lifeline_fd.Pass()) { 163 lifeline_fd_(lifeline_fd.Pass()) {
162 } 164 }
163 165
164 } // namespace chromeos 166 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_typed_url_unittest.cc ('k') | components/history/core/browser/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698