 Chromium Code Reviews
 Chromium Code Reviews Issue 1525023003:
  Distinguish in the browser between renderer crashes and kills  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1525023003:
  Distinguish in the browser between renderer crashes and kills  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: components/crash/content/browser/crash_micro_dump_manager_android.h | 
| diff --git a/components/crash/content/browser/crash_micro_dump_manager_android.h b/components/crash/content/browser/crash_micro_dump_manager_android.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..047fb6e26041c93357d07aaa941b5f05b5837181 | 
| --- /dev/null | 
| +++ b/components/crash/content/browser/crash_micro_dump_manager_android.h | 
| @@ -0,0 +1,68 @@ | 
| +// Copyright 2015 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#ifndef COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_MICRO_DUMP_MANAGER_ANDROID_H_ | 
| +#define COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_MICRO_DUMP_MANAGER_ANDROID_H_ | 
| + | 
| +#include <map> | 
| + | 
| +#include "base/files/file.h" | 
| +#include "base/process/kill.h" | 
| +#include "base/synchronization/lock.h" | 
| +#include "content/public/browser/notification_observer.h" | 
| +#include "content/public/browser/notification_registrar.h" | 
| + | 
| +namespace breakpad { | 
| + | 
| +// This class manages behavior of the browser on renderer crashes when | 
| +// microdumps are used for capturing the crash stack. Normally, in this case | 
| +// the browser doesn't need to do much, because a microdump is written into | 
| +// Android log by the renderer process itself. However, the browser may need to | 
| +// crash itself on a renderer crash. Since on Android renderers are not child | 
| +// processes of the browser, it can't access the exit code. Instead, the browser | 
| +// uses a dedicated pipe in order to receive the information about the renderer | 
| +// crash status. | 
| +class CrashMicroDumpManager : public content::NotificationObserver { | 
| 
Yaron
2016/01/04 22:03:56
should this be in aw/? It only uses content/public
 
mnaganov (inactive)
2016/01/05 00:06:08
Microdumps are implemented in components/crash, an
 | 
| + public: | 
| + // The embedder should create a single instance of the CrashMicroDumpManager. | 
| + static CrashMicroDumpManager* GetInstance(); | 
| + | 
| + // Should be created on the UI thread. | 
| + CrashMicroDumpManager(); | 
| + | 
| + ~CrashMicroDumpManager() override; | 
| + | 
| + // Returns a pipe that should be used to transfer termination cause of | 
| + // |child_process_id|. | 
| + base::File CreateCrashInfoChannel(int child_process_id); | 
| + | 
| + private: | 
| + static void HandleChildTermination( | 
| + int pipe_fd, | 
| + base::TerminationStatus termination_status); | 
| + | 
| + // NotificationObserver implementation: | 
| + void Observe(int type, | 
| + const content::NotificationSource& source, | 
| + const content::NotificationDetails& details) override; | 
| + | 
| + // Called on child process exit (including crash). | 
| + void OnChildExit(int child_process_id, | 
| + base::TerminationStatus termination_status); | 
| + | 
| + content::NotificationRegistrar notification_registrar_; | 
| + | 
| + // This map should only be accessed with its lock aquired as it is accessed | 
| + // from the PROCESS_LAUNCHER and UI threads. | 
| + base::Lock child_process_id_to_pipe_fd_lock_; | 
| + std::map<int, int> child_process_id_to_pipe_fd_; | 
| + | 
| + static CrashMicroDumpManager* instance_; | 
| + | 
| + DISALLOW_COPY_AND_ASSIGN(CrashMicroDumpManager); | 
| +}; | 
| + | 
| +} // namespace breakpad | 
| + | 
| +#endif // COMPONENTS_CRASH_CONTENT_BROWSER_CRASH_MICRO_DUMP_MANAGER_ANDROID_H_ |