diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 00:26:43 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 00:26:43 +0000 |
commit | 4614f1974881ecfd0a0118683bac628c6128c2a9 (patch) | |
tree | c69836459560dd8003f7e18ca554f2e1d7f79b4d /ppapi/shared_impl | |
parent | b8e6654fb91108033580f510e2d411093936fc2f (diff) | |
download | chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.zip chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.tar.gz chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.tar.bz2 |
First pass at making the proxy handle multiple renderers. This associates the
instance with resources and has most callers retrieve the dispatcher
according to the appropriate instance. This isn't hooked up to anything yet.
This changes some PPB_Flash interface methods to use PP_Bool.
The most challenging part of the change is in the plugin_var_tracker which
now needs to track which dispatcher each var object came from, and remap var
IDs since each renderer will be generating var IDs in its own space, which
will likely overlap. A similar system will need to be done for resources
which is not implemented yet.
I added some null checks in audio_impl because audio_ can be NULL in some
cases when using the trusted API. I discovered this when testing NaCl for
this patch.
Review URL: http://codereview.chromium.org/6282007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/shared_impl')
-rw-r--r-- | ppapi/shared_impl/DEPS | 4 | ||||
-rw-r--r-- | ppapi/shared_impl/image_data_impl.cc | 29 | ||||
-rw-r--r-- | ppapi/shared_impl/image_data_impl.h | 32 |
3 files changed, 65 insertions, 0 deletions
diff --git a/ppapi/shared_impl/DEPS b/ppapi/shared_impl/DEPS index 578728a..ebb73ea 100644 --- a/ppapi/shared_impl/DEPS +++ b/ppapi/shared_impl/DEPS @@ -6,4 +6,8 @@ include_rules = [ "-ipc", "-ppapi/cpp", + + # The image data implementation depends on how we're building Skia. This isn't + # a link-time dependency, so it's OK. + "+skia/config/SkUserConfig.h" ] diff --git a/ppapi/shared_impl/image_data_impl.cc b/ppapi/shared_impl/image_data_impl.cc new file mode 100644 index 0000000..afdc512 --- /dev/null +++ b/ppapi/shared_impl/image_data_impl.cc @@ -0,0 +1,29 @@ +// 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 "ppapi/shared_impl/image_data_impl.h" + +#include "skia/config/SkUserConfig.h" + +namespace pp { +namespace shared_impl { + +// static +PP_ImageDataFormat ImageDataImpl::GetNativeImageDataFormat() { + if (SK_B32_SHIFT == 0) + return PP_IMAGEDATAFORMAT_BGRA_PREMUL; + else if (SK_R32_SHIFT == 0) + return PP_IMAGEDATAFORMAT_RGBA_PREMUL; + else + return PP_IMAGEDATAFORMAT_BGRA_PREMUL; // Default to something on failure. +} + +// static +bool ImageDataImpl::IsImageDataFormatSupported(PP_ImageDataFormat format) { + return format == PP_IMAGEDATAFORMAT_BGRA_PREMUL || + format == PP_IMAGEDATAFORMAT_RGBA_PREMUL; +} + +} // namespace shared_impl +} // namespace pp diff --git a/ppapi/shared_impl/image_data_impl.h b/ppapi/shared_impl/image_data_impl.h new file mode 100644 index 0000000..6b8a7cc --- /dev/null +++ b/ppapi/shared_impl/image_data_impl.h @@ -0,0 +1,32 @@ +// 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. + +#ifndef PPAPI_SHARED_IMPL_IMAGE_DATA_IMPL_H_ +#define PPAPI_SHARED_IMPL_IMAGE_DATA_IMPL_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/ppb_image_data.h" + +namespace pp { +namespace shared_impl { + +// Contains the implementation of some simple image data functions that are +// shared between the proxy and Chrome's implementation. Since these functions +// are just lists of what we support, it's much easier to just have the same +// code run in the plugin process than to proxy it. +// +// It's possible the implementation will get more complex. In this case, it's +// probably best to have some kind of "configuration" message that the renderer +// sends to the plugin process on startup that contains all of these kind of +// settings. +class ImageDataImpl { + public: + static PP_ImageDataFormat GetNativeImageDataFormat(); + static bool IsImageDataFormatSupported(PP_ImageDataFormat format); +}; + +} // namespace shared_impl +} // namespace pp + +#endif // PPAPI_SHARED_IMPL_IMAGE_DATA_IMPL_H_ |