diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-18 17:47:49 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-18 17:47:49 +0000 |
commit | de9cfbce825a56e003bf0140ac83a3211c72ad9f (patch) | |
tree | 5d04897da40a06dbaffdfce61493ce7193700b11 /webkit/glue/plugins | |
parent | 377b4cc93ed0ca53988f5cc23026fb1ca3c6d838 (diff) | |
download | chromium_src-de9cfbce825a56e003bf0140ac83a3211c72ad9f.zip chromium_src-de9cfbce825a56e003bf0140ac83a3211c72ad9f.tar.gz chromium_src-de9cfbce825a56e003bf0140ac83a3211c72ad9f.tar.bz2 |
Pull latest ppapi for initial testing support, implement checks so the tests pass in Chrome. Mostly, this involves better error checking.
The most substantial change is that I made TransportDIB able to return NULL on failure to make a PlatformCanvas, which we run into when makeing too large of a canvas from a plugin. I checked all the callers of this function to make sure they all handled the problem (many already did).
TEST=pulls Pepper test
BUG=-none
Review URL: http://codereview.chromium.org/2101004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/pepper_image_data.cc | 9 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_instance.h | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_resource.h | 3 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_resource_tracker.h | 3 |
4 files changed, 13 insertions, 6 deletions
diff --git a/webkit/glue/plugins/pepper_image_data.cc b/webkit/glue/plugins/pepper_image_data.cc index cf86437..ba6ebd7 100644 --- a/webkit/glue/plugins/pepper_image_data.cc +++ b/webkit/glue/plugins/pepper_image_data.cc @@ -5,6 +5,7 @@ #include "webkit/glue/plugins/pepper_image_data.h" #include <algorithm> +#include <limits> #include "base/logging.h" #include "base/scoped_ptr.h" @@ -107,6 +108,14 @@ bool ImageData::Init(PP_ImageDataFormat format, bool init_to_zero) { // TODO(brettw) this should be called only on the main thread! // TODO(brettw) use init_to_zero when we implement caching. + if (format != PP_IMAGEDATAFORMAT_BGRA_PREMUL) + return false; // Only support this one format for now. + if (width <= 0 || height <= 0) + return false; + if (static_cast<int64>(width) * static_cast<int64>(height) >= + std::numeric_limits<int32>::max()) + return false; // Prevent overflow of signed 32-bit ints. + platform_image_.reset( module()->GetSomeInstance()->delegate()->CreateImage2D(width, height)); width_ = width; diff --git a/webkit/glue/plugins/pepper_plugin_instance.h b/webkit/glue/plugins/pepper_plugin_instance.h index b81ad09..3286928 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.h +++ b/webkit/glue/plugins/pepper_plugin_instance.h @@ -10,10 +10,10 @@ #include "base/basictypes.h" #include "base/ref_counted.h" +#include "third_party/ppapi/c/pp_instance.h" +#include "third_party/ppapi/c/pp_resource.h" #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" -typedef struct _pp_Instance PP_Instance; -typedef struct _pp_Resource PP_Resource; typedef struct _pp_Var PP_Var; typedef struct _ppb_Instance PPB_Instance; typedef struct _ppp_Instance PPP_Instance; diff --git a/webkit/glue/plugins/pepper_resource.h b/webkit/glue/plugins/pepper_resource.h index 6cf1e28..e70ff4a 100644 --- a/webkit/glue/plugins/pepper_resource.h +++ b/webkit/glue/plugins/pepper_resource.h @@ -7,8 +7,7 @@ #include "base/basictypes.h" #include "base/ref_counted.h" - -typedef struct _pp_Resource PP_Resource; +#include "third_party/ppapi/c/pp_resource.h" namespace pepper { diff --git a/webkit/glue/plugins/pepper_resource_tracker.h b/webkit/glue/plugins/pepper_resource_tracker.h index f24afc2..b3a67bd 100644 --- a/webkit/glue/plugins/pepper_resource_tracker.h +++ b/webkit/glue/plugins/pepper_resource_tracker.h @@ -12,8 +12,7 @@ #include "base/lock.h" #include "base/ref_counted.h" #include "base/singleton.h" - -typedef struct _pp_Resource PP_Resource; +#include "third_party/ppapi/c/pp_resource.h" namespace pepper { |