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

Side by Side Diff: android_webview/browser/aw_browser_terminator.h

Issue 2200693002: Refactor CrashDump*Manager to use a shared CrashDumpObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang compile errors 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_BROWSER_TERMINATOR_H_
6 #define COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_BROWSER_TERMINATOR_H_
7
8 #include <map>
9
10 #include "base/sync_socket.h"
11 #include "base/synchronization/lock.h"
12 #include "components/crash/content/browser/crash_dump_observer_android.h"
13
14 namespace android_webview {
15
16 // This class manages behavior of the browser on renderer crashes when
17 // microdumps are used for capturing the crash stack. Normally, in this case
18 // the browser doesn't need to do much, because a microdump is written into
19 // Android log by the renderer process itself. However, the browser may need to
20 // crash itself on a renderer crash. Since on Android renderers are not child
21 // processes of the browser, it can't access the exit code. Instead, the browser
22 // uses a dedicated pipe in order to receive the information about the renderer
23 // crash status.
24 class AwBrowserTerminator : public breakpad::CrashDumpObserver::Client {
25 public:
26 AwBrowserTerminator();
27 ~AwBrowserTerminator() override;
28
29 // CrashDumpObserver::Client implementation.
30 void OnChildStart(int child_process_id,
31 content::FileDescriptorInfo* mappings) override;
32 void OnChildExit(int child_process_id,
33 base::ProcessHandle pid,
34 content::ProcessType process_type,
35 base::TerminationStatus termination_status,
36 base::android::ApplicationState app_state) override;
37
38 private:
39 // This map should only be accessed with its lock aquired as it is accessed
40 // from the PROCESS_LAUNCHER, FILE, and UI threads.
41 base::Lock child_process_id_to_pipe_lock_;
42 std::map<int, std::unique_ptr<base::SyncSocket>> child_process_id_to_pipe_;
43
44 DISALLOW_COPY_AND_ASSIGN(AwBrowserTerminator);
45 };
46
47 } // namespace breakpad
48
49 #endif // COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_DUMP_BROWSER_TERMINATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698