chromium/ppapi/shared_impl/host_resource.h

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

#ifndef PPAPI_SHARED_IMPL_HOST_RESOURCE_H_
#define PPAPI_SHARED_IMPL_HOST_RESOURCE_H_

#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"

namespace ppapi {

// For "old" style resources, PP_Resource values differ on the host and plugin
// side. Implementations of those should be careful to use HostResource to
// prevent confusion. "New" style resources use the same PP_Resource value on
// the host and plugin sides, and should not use HostResource.
//
// Old style resources match these file specs:
//   Proxy: ppapi/proxy/ppb_*_proxy.*
//   Host: content/ppapi_plugin/*
// New style resources match these file specs:
//   Proxy: ppapi/proxy/*_resource.*
//   Browser: (content|chrome)/browser/renderer_host/pepper/pepper_*_host.*
//   Renderer: (content|chrome)/renderer/pepper/pepper_*_host.*
//
//
// Represents a PP_Resource sent over the wire. This just wraps a PP_Resource.
// The point is to prevent mistakes where the wrong resource value is sent.
// Resource values are remapped in the plugin so that it can talk to multiple
// hosts. If all values were PP_Resource, it would be easy to forget to do
// this transformation.
//
// To get the corresponding plugin PP_Resource for a HostResource, use
// PluginResourceTracker::PluginResourceForHostResource().
//
// All HostResources respresent IDs valid in the host.
class PPAPI_SHARED_EXPORT HostResource {};

}  // namespace ppapi

#endif  // PPAPI_SHARED_IMPL_HOST_RESOURCE_H_