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

Side by Side Diff: components/crash/content/browser/crash_micro_dump_manager_android.h

Issue 1525023003: Distinguish in the browser between renderer crashes and kills (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finalized, RFC Created 5 years 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 2015 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_MICRO_DUMP_MANAGER_ANDROID_H_
6 #define COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_MICRO_DUMP_MANAGER_ANDROID_H_
7
8 #include <map>
9
10 #include "base/files/file.h"
11 #include "base/synchronization/lock.h"
12 #include "content/public/browser/browser_child_process_observer.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
15
16 namespace breakpad {
17
18 // This class manages behavior of the browser on renderer crashes when
19 // microdumps are used for capturing the crash stack. Normally, in this case
20 // the browser doesn't need to do much, because a microdump is written into
21 // Android log by the renderer process itself. However, the browser may need to
22 // crash itself on a renderer crash. Since on Android renderers are not child
23 // processes of the browser, it can't access the exit code. Instead, the browser
24 // uses a dedicated pipe in order to receive the information about the renderer
25 // crash status.
26 class CrashMicroDumpManager : public content::BrowserChildProcessObserver,
27 public content::NotificationObserver {
28 public:
29 // The embedder should create a single instance of the CrashMicroDumpManager.
30 static CrashMicroDumpManager* GetInstance();
31
32 // Should be created on the UI thread.
33 CrashMicroDumpManager();
34
35 ~CrashMicroDumpManager() override;
36
37 // Returns a pipe that should be used to transfer termination cause of
38 // |child_process_id|.
39 base::File CreateCrashInfoChannel(int child_process_id);
40
41 private:
42 static void HandleChildTermination(int pipe_fd);
43
44 // content::BrowserChildProcessObserver implementation:
45 void BrowserChildProcessHostDisconnected(
46 const content::ChildProcessData& data) override;
47 void BrowserChildProcessCrashed(
48 const content::ChildProcessData& data,
49 int exit_code) override;
50
51 // NotificationObserver implementation:
52 void Observe(int type,
53 const content::NotificationSource& source,
54 const content::NotificationDetails& details) override;
55
56 // Called on child process exit (including crash).
57 void OnChildExit(int child_process_id);
58
59 content::NotificationRegistrar notification_registrar_;
60
61 // This map should only be accessed with its lock aquired as it is accessed
62 // from the PROCESS_LAUNCHER and UI threads.
63 base::Lock child_process_id_to_pipe_fd_lock_;
64 std::map<int, int> child_process_id_to_pipe_fd_;
65
66 static CrashMicroDumpManager* instance_;
67
68 DISALLOW_COPY_AND_ASSIGN(CrashMicroDumpManager);
69 };
70
71 } // namespace breakpad
72
73 #endif // COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_MICRO_DUMP_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698