dom/ipc/CrashReporterChild.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/ipc/CrashReporterChild.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + * vim: set sw=4 ts=8 et tw=80 : 
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +#include "mozilla/plugins/PluginModuleChild.h"
    1.10 +#include "ContentChild.h"
    1.11 +#include "CrashReporterChild.h"
    1.12 +#include "nsXULAppAPI.h"
    1.13 +
    1.14 +using mozilla::plugins::PluginModuleChild;
    1.15 +
    1.16 +namespace mozilla {
    1.17 +namespace dom {
    1.18 +
    1.19 +/*static*/
    1.20 +PCrashReporterChild*
    1.21 +CrashReporterChild::GetCrashReporter()
    1.22 +{
    1.23 +  const InfallibleTArray<PCrashReporterChild*>* reporters = nullptr;
    1.24 +  switch (XRE_GetProcessType()) {
    1.25 +    case GeckoProcessType_Content: {
    1.26 +      ContentChild* child = ContentChild::GetSingleton();
    1.27 +      reporters = &child->ManagedPCrashReporterChild();
    1.28 +      break;
    1.29 +    }
    1.30 +    case GeckoProcessType_Plugin: {
    1.31 +      PluginModuleChild* child = PluginModuleChild::current();
    1.32 +      reporters = &child->ManagedPCrashReporterChild();
    1.33 +      break;
    1.34 +    }
    1.35 +    default:
    1.36 +      break;
    1.37 +  }
    1.38 +  if (reporters && reporters->Length() > 0) {
    1.39 +    return reporters->ElementAt(0);
    1.40 +  }
    1.41 +  return nullptr;
    1.42 +}
    1.43 +
    1.44 +}
    1.45 +}

mercurial