<commit_before>// 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.

#include "sky/shell/platform/mac/platform_service_provider.h"

namespace sky {
namespace shell {

PlatformServiceProvider::PlatformServiceProvider(
    mojo::InterfaceRequest<mojo::ServiceProvider> request)
    : binding_(this, request.Pass()) {}

PlatformServiceProvider::~PlatformServiceProvider() {}

void PlatformServiceProvider::ConnectToService(
    const mojo::String& service_name,
    mojo::ScopedMessagePipeHandle client_handle) {
  if (service_name == mojo::NetworkService::Name_) {
    network_.Create(
        nullptr, mojo::MakeRequest<mojo::NetworkService>(client_handle.Pass()));
  }
#if TARGET_OS_IPHONE
  if (service_name == ::keyboard::KeyboardService::Name_) {
    keyboard_.Create(nullptr, mojo::MakeRequest<::keyboard::KeyboardService>(
                                  client_handle.Pass()));
  }
  if (service_name == ::media::MediaPlayer::Name_) {
    media_player_.Create(
        nullptr, mojo::MakeRequest<::media::MediaPlayer>(client_handle.Pass()));
  }
  if (service_name == ::media::MediaService::Name_) {
    media_service_.Create(nullptr, mojo::MakeRequest<::media::MediaService>(
                                       client_handle.Pass()));
  }
  if (service_name == ::vsync::VSyncProvider::Name_) {
    vsync_.Create(nullptr, mojo::MakeRequest<::vsync::VSyncProvider>(
                               client_handle.Pass()));
  }
  if (service_name == ::activity::PathService::Name_) {
    path_.Create(nullptr, mojo::MakeRequest<::activity::PathService>(
                              client_handle.Pass()));
  }
  if (service_name == ::activity::Activity::Name_) {
    activity_.Create(
        nullptr, mojo::MakeRequest<::activity::Activity>(client_handle.Pass()));
  }
#endif
}

}  // namespace shell
}  // namespace sky<commit_msg>Add an assertion in debug if the application requests an unknown service<commit_after>// 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.

#include "base/logging.h"
#include "sky/shell/platform/mac/platform_service_provider.h"

namespace sky {
namespace shell {

PlatformServiceProvider::PlatformServiceProvider(
    mojo::InterfaceRequest<mojo::ServiceProvider> request)
    : binding_(this, request.Pass()) {}

PlatformServiceProvider::~PlatformServiceProvider() {}

void PlatformServiceProvider::ConnectToService(
    const mojo::String& service_name,
    mojo::ScopedMessagePipeHandle client_handle) {
  if (service_name == mojo::NetworkService::Name_) {
    network_.Create(
        nullptr, mojo::MakeRequest<mojo::NetworkService>(client_handle.Pass()));
    return;
  }
#if TARGET_OS_IPHONE
  if (service_name == ::keyboard::KeyboardService::Name_) {
    keyboard_.Create(nullptr, mojo::MakeRequest<::keyboard::KeyboardService>(
                                  client_handle.Pass()));
    return;
  }
  if (service_name == ::media::MediaPlayer::Name_) {
    media_player_.Create(
        nullptr, mojo::MakeRequest<::media::MediaPlayer>(client_handle.Pass()));
    return;
  }
  if (service_name == ::media::MediaService::Name_) {
    media_service_.Create(nullptr, mojo::MakeRequest<::media::MediaService>(
                                       client_handle.Pass()));
    return;
  }
  if (service_name == ::vsync::VSyncProvider::Name_) {
    vsync_.Create(nullptr, mojo::MakeRequest<::vsync::VSyncProvider>(
                               client_handle.Pass()));
    return;
  }
  if (service_name == ::activity::PathService::Name_) {
    path_.Create(nullptr, mojo::MakeRequest<::activity::PathService>(
                              client_handle.Pass()));
    return;
  }
  if (service_name == ::activity::Activity::Name_) {
    activity_.Create(
        nullptr, mojo::MakeRequest<::activity::Activity>(client_handle.Pass()));
    return;
  }
#endif

  LOG(INFO) << "The platform service provider cannot find a service for '"
            << service_name.data() << "'";
  mojo::Close(client_handle.Pass());
}

}  // namespace shell
}  // namespace sky
{'fraction_non_alphanumeric': 0.13884297520661157, 'fraction_numerical': 0.0018890200708382527, 'mean_word_length': 3.764904386951631, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6981644', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1198, 'n_words': 224}