OLD | NEW |
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 "components/crash/content/browser/crash_micro_dump_manager_android.h" | 5 #include "components/crash/content/browser/crash_micro_dump_manager_android.h" |
6 | 6 |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 CrashMicroDumpManager::~CrashMicroDumpManager() { | 37 CrashMicroDumpManager::~CrashMicroDumpManager() { |
38 base::AutoLock auto_lock(child_process_id_to_pipe_lock_); | 38 base::AutoLock auto_lock(child_process_id_to_pipe_lock_); |
39 child_process_id_to_pipe_.clear(); | 39 child_process_id_to_pipe_.clear(); |
40 } | 40 } |
41 | 41 |
42 base::ScopedFD CrashMicroDumpManager::CreateCrashInfoChannel( | 42 base::ScopedFD CrashMicroDumpManager::CreateCrashInfoChannel( |
43 int child_process_id) { | 43 int child_process_id) { |
44 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); | 44 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); |
45 scoped_ptr<base::SyncSocket> local_pipe(new base::SyncSocket()); | 45 std::unique_ptr<base::SyncSocket> local_pipe(new base::SyncSocket()); |
46 scoped_ptr<base::SyncSocket> child_pipe(new base::SyncSocket()); | 46 std::unique_ptr<base::SyncSocket> child_pipe(new base::SyncSocket()); |
47 if (!base::SyncSocket::CreatePair(local_pipe.get(), child_pipe.get())) | 47 if (!base::SyncSocket::CreatePair(local_pipe.get(), child_pipe.get())) |
48 return base::ScopedFD(); | 48 return base::ScopedFD(); |
49 { | 49 { |
50 base::AutoLock auto_lock(child_process_id_to_pipe_lock_); | 50 base::AutoLock auto_lock(child_process_id_to_pipe_lock_); |
51 DCHECK(!ContainsKey(child_process_id_to_pipe_, child_process_id)); | 51 DCHECK(!ContainsKey(child_process_id_to_pipe_, child_process_id)); |
52 child_process_id_to_pipe_[child_process_id] = std::move(local_pipe); | 52 child_process_id_to_pipe_[child_process_id] = std::move(local_pipe); |
53 } | 53 } |
54 return base::ScopedFD(dup(child_pipe->handle())); | 54 return base::ScopedFD(dup(child_pipe->handle())); |
55 } | 55 } |
56 | 56 |
57 void CrashMicroDumpManager::HandleChildTerminationOnFileThread( | 57 void CrashMicroDumpManager::HandleChildTerminationOnFileThread( |
58 int child_process_id, | 58 int child_process_id, |
59 base::TerminationStatus termination_status) { | 59 base::TerminationStatus termination_status) { |
60 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 60 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
61 | 61 |
62 scoped_ptr<base::SyncSocket> pipe; | 62 std::unique_ptr<base::SyncSocket> pipe; |
63 { | 63 { |
64 base::AutoLock auto_lock(child_process_id_to_pipe_lock_); | 64 base::AutoLock auto_lock(child_process_id_to_pipe_lock_); |
65 const auto& iter = child_process_id_to_pipe_.find(child_process_id); | 65 const auto& iter = child_process_id_to_pipe_.find(child_process_id); |
66 if (iter == child_process_id_to_pipe_.end()) { | 66 if (iter == child_process_id_to_pipe_.end()) { |
67 // We might get a NOTIFICATION_RENDERER_PROCESS_TERMINATED and a | 67 // We might get a NOTIFICATION_RENDERER_PROCESS_TERMINATED and a |
68 // NOTIFICATION_RENDERER_PROCESS_CLOSED. | 68 // NOTIFICATION_RENDERER_PROCESS_CLOSED. |
69 return; | 69 return; |
70 } | 70 } |
71 pipe = std::move(iter->second); | 71 pipe = std::move(iter->second); |
72 child_process_id_to_pipe_.erase(iter); | 72 child_process_id_to_pipe_.erase(iter); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return; | 120 return; |
121 } | 121 } |
122 BrowserThread::PostTask( | 122 BrowserThread::PostTask( |
123 BrowserThread::FILE, FROM_HERE, | 123 BrowserThread::FILE, FROM_HERE, |
124 base::Bind(&CrashMicroDumpManager::HandleChildTerminationOnFileThread, | 124 base::Bind(&CrashMicroDumpManager::HandleChildTerminationOnFileThread, |
125 weak_factory_.GetWeakPtr(), rph->GetID(), | 125 weak_factory_.GetWeakPtr(), rph->GetID(), |
126 termination_status)); | 126 termination_status)); |
127 } | 127 } |
128 | 128 |
129 } // namespace breakpad | 129 } // namespace breakpad |
OLD | NEW |