<commit_before>// Copyright (c) 2011 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.

#include "content/browser/mach_broker_mac.h"

#include "base/command_line.h"
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mach_ipc_mac.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/sys_string_conversions.h"
#include "base/threading/platform_thread.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/common/child_process_info.h"
#include "content/common/notification_service.h"
#include "content/public/common/content_switches.h"

namespace {
// Prints a string representation of a Mach error code.
std::string MachErrorCode(kern_return_t err) {
  return base::StringPrintf("0x%x %s", err, mach_error_string(err));
}
}  // namespace

// Required because notifications happen on the UI thread.
class RegisterNotificationTask : public Task {
 public:
  RegisterNotificationTask(
      MachBroker* broker)
      : broker_(broker) { }

  virtual void Run() {
    broker_->registrar_.Add(broker_,
        content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
        NotificationService::AllSources());
    broker_->registrar_.Add(broker_,
        content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
        NotificationService::AllSources());
    broker_->registrar_.Add(broker_,
        content::NOTIFICATION_CHILD_PROCESS_CRASHED,
        NotificationService::AllSources());
    broker_->registrar_.Add(broker_,
        content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED,
        NotificationService::AllSources());
  }<commit_msg>Change usage of AllSources to AllBrowserContextsAndSources to indicate that usage is safe for multiprofiles.<commit_after>// Copyright (c) 2011 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.

#include "content/browser/mach_broker_mac.h"

#include "base/command_line.h"
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mach_ipc_mac.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/sys_string_conversions.h"
#include "base/threading/platform_thread.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/common/child_process_info.h"
#include "content/common/notification_service.h"
#include "content/public/common/content_switches.h"

namespace {
// Prints a string representation of a Mach error code.
std::string MachErrorCode(kern_return_t err) {
  return base::StringPrintf("0x%x %s", err, mach_error_string(err));
}
}  // namespace

// Required because notifications happen on the UI thread.
class RegisterNotificationTask : public Task {
 public:
  RegisterNotificationTask(
      MachBroker* broker)
      : broker_(broker) { }

  virtual void Run() {
    broker_->registrar_.Add(broker_,
        content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
        NotificationService::AllBrowserContextsAndSources());
    broker_->registrar_.Add(broker_,
        content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
        NotificationService::AllBrowserContextsAndSources());
    broker_->registrar_.Add(broker_,
        content::NOTIFICATION_CHILD_PROCESS_CRASHED,
        NotificationService::AllBrowserContextsAndSources());
    broker_->registrar_.Add(broker_,
        content::NOTIFICATION_CHILD_PROCESS_HOST_DISCONNECTED,
        NotificationService::AllBrowserContextsAndSources());
  }
{'fraction_non_alphanumeric': 0.10651048760555706, 'fraction_numerical': 0.002724053391446472, 'mean_word_length': 5.08955223880597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6940262', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1134, 'n_words': 229}