chromium/ppapi/proxy/BUILD.gn

# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/nacl/config.gni")
import("//components/nacl/toolchain.gni")
import("//ppapi/buildflags/buildflags.gni")

assert(enable_ppapi)

config("proxy_implementation") {
  defines = [ "PPAPI_PROXY_IMPLEMENTATION" ]
}

component("proxy") {
  output_name = "ppapi_proxy"

  sources = [
    # Take some standalone files from the C++ wrapper allowing us to more
    # easily make async callbacks in the proxy. We can't depend on the
    # full C++ wrappers at this layer since the C++ wrappers expect
    # symbols defining the globals for "being a plugin" which we are not.
    #
    # These callback files are supposed to be standalone, but are not; see
    # http://crbug.com/1228394.
    "../cpp/completion_callback.h",
    "../cpp/logging.h",
    "../utility/completion_callback_factory.h",
    "audio_buffer_resource.cc",
    "audio_buffer_resource.h",
    "camera_capabilities_resource.cc",
    "camera_capabilities_resource.h",
    "camera_device_resource.cc",
    "camera_device_resource.h",
    "dispatcher.cc",
    "enter_proxy.h",
    "error_conversion.cc",
    "error_conversion.h",
    "file_chooser_resource.cc",
    "file_chooser_resource.h",
    "file_io_resource.cc",
    "file_io_resource.h",
    "file_ref_resource.cc",
    "file_ref_resource.h",
    "file_system_resource.cc",
    "file_system_resource.h",
    "gamepad_resource.cc",
    "gamepad_resource.h",
    "graphics_2d_resource.cc",
    "graphics_2d_resource.h",
    "host_resolver_private_resource.cc",
    "host_resolver_resource.cc",
    "host_resolver_resource.h",
    "host_resolver_resource_base.cc",
    "interface_list.cc",
    "interface_proxy.cc",
    "isolated_file_system_private_resource.cc",
    "isolated_file_system_private_resource.h",
    "locking_resource_releaser.h",
    "media_stream_audio_track_resource.cc",
    "media_stream_audio_track_resource.h",
    "media_stream_track_resource_base.cc",
    "media_stream_track_resource_base.h",
    "media_stream_video_track_resource.cc",
    "media_stream_video_track_resource.h",
    "message_handler.cc",
    "net_address_resource.cc",
    "net_address_resource.h",
    "network_list_resource.cc",
    "network_monitor_resource.cc",
    "network_monitor_resource.h",
    "network_proxy_resource.cc",
    "network_proxy_resource.h",
    "plugin_array_buffer_var.cc",
    "plugin_array_buffer_var.h",
    "plugin_dispatcher.cc",
    "plugin_globals.cc",
    "plugin_globals.h",
    "plugin_message_filter.cc",
    "plugin_message_filter.h",
    "plugin_resource.cc",
    "plugin_resource_tracker.cc",
    "plugin_resource_tracker.h",
    "plugin_resource_var.cc",
    "plugin_resource_var.h",
    "plugin_var_serialization_rules.cc",
    "plugin_var_serialization_rules.h",
    "plugin_var_tracker.cc",
    "ppapi_command_buffer_proxy.cc",
    "ppapi_command_buffer_proxy.h",
    "ppb_audio_proxy.cc",
    "ppb_audio_proxy.h",
    "ppb_core_proxy.cc",
    "ppb_core_proxy.h",
    "ppb_graphics_3d_proxy.cc",
    "ppb_graphics_3d_proxy.h",
    "ppb_image_data_proxy.cc",
    "ppb_image_data_proxy.h",
    "ppb_instance_proxy.cc",
    "ppb_instance_proxy.h",
    "ppb_message_loop_proxy.cc",
    "ppb_message_loop_proxy.h",
    "ppb_testing_proxy.cc",
    "ppb_testing_proxy.h",
    "ppp_class_proxy.cc",
    "ppp_class_proxy.h",
    "ppp_graphics_3d_proxy.cc",
    "ppp_graphics_3d_proxy.h",
    "ppp_input_event_proxy.cc",
    "ppp_input_event_proxy.h",
    "ppp_instance_proxy.cc",
    "ppp_instance_proxy.h",
    "ppp_messaging_proxy.cc",
    "ppp_messaging_proxy.h",
    "ppp_mouse_lock_proxy.cc",
    "ppp_mouse_lock_proxy.h",
    "ppp_printing_proxy.cc",
    "ppp_printing_proxy.h",
    "ppp_text_input_proxy.cc",
    "ppp_text_input_proxy.h",
    "printing_resource.cc",
    "printing_resource.h",
    "proxy_array_output.cc",
    "proxy_array_output.h",
    "proxy_channel.cc",
    "proxy_completion_callback_factory.h",
    "proxy_object_var.cc",
    "proxy_object_var.h",
    "resource_creation_proxy.cc",
    "resource_creation_proxy.h",
    "resource_reply_thread_registrar.cc",
    "tcp_server_socket_private_resource.cc",
    "tcp_server_socket_private_resource.h",
    "tcp_socket_private_resource.cc",
    "tcp_socket_private_resource.h",
    "tcp_socket_resource.cc",
    "tcp_socket_resource.h",
    "tcp_socket_resource_base.cc",
    "tcp_socket_resource_base.h",
    "udp_socket_filter.cc",
    "udp_socket_filter.h",
    "udp_socket_private_resource.cc",
    "udp_socket_private_resource.h",
    "udp_socket_resource.cc",
    "udp_socket_resource.h",
    "udp_socket_resource_base.cc",
    "udp_socket_resource_base.h",
    "uma_private_resource.cc",
    "uma_private_resource.h",
    "url_loader_resource.cc",
    "url_loader_resource.h",
    "url_request_info_resource.cc",
    "url_request_info_resource.h",
    "url_response_info_resource.cc",
    "url_response_info_resource.h",
    "video_decoder_resource.cc",
    "video_decoder_resource.h",
    "video_encoder_resource.cc",
    "video_encoder_resource.h",
    "video_frame_resource.cc",
    "video_frame_resource.h",
    "vpn_provider_resource.cc",
    "vpn_provider_resource.h",
    "websocket_resource.cc",
    "websocket_resource.h",
  ]

  if (is_nacl) {
    # Consistency check: Check that is_nacl_irt is set to true for this
    # code that is built for the NaCl IRT.  Previously, there was a bug
    # where is_nacl_irt was not always set to true for builds of the NaCl
    # IRT.
    assert(is_nacl_irt)

    sources += [
      "../nacl_irt/irt_interfaces.cc",
      "../nacl_irt/irt_interfaces.h",
      "../nacl_irt/irt_pnacl_translator_compile.cc",
      "../nacl_irt/irt_pnacl_translator_link.cc",
      "../nacl_irt/irt_ppapi.cc",
      "../nacl_irt/irt_ppapi.h",
      "../nacl_irt/irt_start.cc",
      "../nacl_irt/manifest_service.cc",
      "../nacl_irt/manifest_service.h",
      "../nacl_irt/plugin_startup.cc",
      "../nacl_irt/plugin_startup.h",
      "../nacl_irt/ppapi_dispatcher.cc",
      "../nacl_irt/ppapi_dispatcher.h",
    ]
  } else {
    sources += [
      "audio_input_resource.cc",
      "audio_input_resource.h",
      "audio_output_resource.cc",
      "audio_output_resource.h",
      "browser_font_singleton_resource.cc",
      "browser_font_singleton_resource.h",
      "device_enumeration_resource_helper.cc",
      "device_enumeration_resource_helper.h",
      "host_dispatcher.cc",
      "host_dispatcher.h",
      "host_var_serialization_rules.cc",
      "host_var_serialization_rules.h",
      "ppb_buffer_proxy.cc",
      "ppb_var_deprecated_proxy.cc",
      "ppb_var_deprecated_proxy.h",
      "ppb_video_decoder_proxy.cc",
      "ppb_video_decoder_proxy.h",
      "ppb_x509_certificate_private_proxy.cc",
      "ppb_x509_certificate_private_proxy.h",
      "ppp_instance_private_proxy.cc",
      "ppp_instance_private_proxy.h",
      "ppp_video_decoder_proxy.cc",
      "ppp_video_decoder_proxy.h",
      "video_capture_resource.cc",
      "video_capture_resource.h",
    ]
  }

  configs += [
    ":proxy_implementation",
    "//build/config:precompiled_headers",
  ]

  public_deps = [
    "//ipc",
    "//ppapi/proxy:ipc_sources",
  ]

  deps = [
    ":common",
    "//base",
    "//components/nacl/common:buildflags",
    "//device/base/synchronization",
    "//device/gamepad/public/cpp:shared_with_blink",
    "//gpu/command_buffer/client:client",
    "//gpu/command_buffer/client:gles2_cmd_helper",
    "//gpu/command_buffer/client:gles2_implementation",
    "//gpu/command_buffer/common",
    "//gpu/ipc/common:command_buffer_traits",
    "//media:shared_memory_support",
    "//mojo/core/embedder",
    "//ppapi/c",
    "//ppapi/shared_impl",
    "//third_party/icu",
    "//ui/gfx/geometry",
    "//ui/gfx/ipc/geometry",
  ]

  if (!is_nacl && !is_minimal_toolchain) {
    deps += [
      "//gin",
      "//skia",
      "//ui/events:events_base",
      "//ui/surface",
    ]
  }
}

source_set("common") {
  sources = [
    "tcp_socket_resource_constants.h",
    "udp_socket_resource_constants.h",
  ]

  deps = [ "//base:base" ]
}

group("ipc") {
  if (is_component_build) {
    public_deps = [ "//ppapi/proxy" ]
  } else {
    public_deps = [ ":ipc_sources" ]
  }
}

source_set("ipc_sources") {
  sources = [
    "connection.h",
    "dispatcher.h",
    "host_resolver_private_resource.h",
    "host_resolver_resource_base.h",
    "interface_list.h",
    "interface_proxy.h",
    "message_handler.h",
    "nacl_message_scanner.cc",
    "nacl_message_scanner.h",
    "network_list_resource.h",
    "plugin_dispatcher.h",
    "plugin_resource.h",
    "plugin_var_tracker.h",
    "ppapi_message_utils.h",
    "ppapi_messages.cc",
    "ppapi_messages.h",
    "ppapi_param_traits.cc",
    "ppapi_param_traits.h",
    "ppb_buffer_proxy.h",
    "proxy_channel.h",
    "raw_var_data.cc",
    "raw_var_data.h",
    "resource_message_params.cc",
    "resource_message_params.h",
    "resource_reply_thread_registrar.h",
    "serialized_handle.cc",
    "serialized_handle.h",
    "serialized_structs.cc",
    "serialized_structs.h",
    "serialized_var.cc",
    "serialized_var.h",
    "var_serialization_rules.h",
  ]

  configs += [ ":proxy_implementation" ]

  deps = [
    "//base",
    "//gpu/ipc/common:command_buffer_traits",
    "//ppapi/c",
    "//ppapi/shared_impl",
  ]

  public_deps = [ "//ipc" ]

  if (!is_nacl && !is_minimal_toolchain) {
    deps += [ "//skia" ]
  }
}

static_library("test_support") {
  testonly = true

  sources = [
    "ppapi_proxy_test.cc",
    "ppapi_proxy_test.h",
    "resource_message_test_sink.cc",
    "resource_message_test_sink.h",
  ]

  public_deps = [ ":proxy" ]
  deps = [
    "//base/test:test_support",
    "//ipc",
    "//ipc:test_support",
    "//ppapi/proxy",
    "//ppapi/shared_impl",
    "//ppapi/shared_impl:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
}