summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-18 17:47:49 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-18 17:47:49 +0000
commitde9cfbce825a56e003bf0140ac83a3211c72ad9f (patch)
tree5d04897da40a06dbaffdfce61493ce7193700b11 /app
parent377b4cc93ed0ca53988f5cc23026fb1ca3c6d838 (diff)
downloadchromium_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 'app')
-rw-r--r--app/surface/transport_dib.h3
-rw-r--r--app/surface/transport_dib_linux.cc7
-rw-r--r--app/surface/transport_dib_mac.cc7
-rw-r--r--app/surface/transport_dib_win.cc6
4 files changed, 18 insertions, 5 deletions
diff --git a/app/surface/transport_dib.h b/app/surface/transport_dib.h
index 44fb6a9..ffa10e4 100644
--- a/app/surface/transport_dib.h
+++ b/app/surface/transport_dib.h
@@ -131,6 +131,9 @@ class TransportDIB {
// Returns a canvas using the memory of this TransportDIB. The returned
// pointer will be owned by the caller. The bitmap will be of the given size,
// which should fit inside this memory.
+ //
+ // Will return NULL on allocation failure. This could be because the image
+ // is too large to map into the current process' address space.
skia::PlatformCanvas* GetPlatformCanvas(int w, int h);
// Return a pointer to the shared memory
diff --git a/app/surface/transport_dib_linux.cc b/app/surface/transport_dib_linux.cc
index 6c41a0c..26cad3f 100644
--- a/app/surface/transport_dib_linux.cc
+++ b/app/surface/transport_dib_linux.cc
@@ -10,6 +10,7 @@
#include "app/surface/transport_dib.h"
#include "app/x11_util.h"
#include "base/logging.h"
+#include "base/scoped_ptr.h"
#include "gfx/size.h"
#include "skia/ext/platform_canvas.h"
@@ -86,8 +87,10 @@ bool TransportDIB::is_valid(Handle dib) {
}
skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
- return new skia::PlatformCanvas(w, h, true,
- reinterpret_cast<uint8_t*>(memory()));
+ scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas);
+ if (!canvas->initialize(w, h, true, reinterpret_cast<uint8_t*>(memory())))
+ return NULL;
+ return canvas.release();
}
void* TransportDIB::memory() const {
diff --git a/app/surface/transport_dib_mac.cc b/app/surface/transport_dib_mac.cc
index cc56ab6..ef1d242 100644
--- a/app/surface/transport_dib_mac.cc
+++ b/app/surface/transport_dib_mac.cc
@@ -8,6 +8,7 @@
#include <sys/stat.h>
#include "base/eintr_wrapper.h"
+#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
#include "skia/ext/platform_canvas.h"
@@ -60,8 +61,10 @@ bool TransportDIB::is_valid(Handle dib) {
}
skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
- return new skia::PlatformCanvas(w, h, true,
- reinterpret_cast<uint8_t*>(memory()));
+ scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas);
+ if (!canvas->initialize(w, h, true, reinterpret_cast<uint8_t*>(memory())))
+ return NULL;
+ return canvas.release();
}
void* TransportDIB::memory() const {
diff --git a/app/surface/transport_dib_win.cc b/app/surface/transport_dib_win.cc
index 2a92fb1..9246f24 100644
--- a/app/surface/transport_dib_win.cc
+++ b/app/surface/transport_dib_win.cc
@@ -7,6 +7,7 @@
#include "app/surface/transport_dib.h"
#include "base/logging.h"
+#include "base/scoped_ptr.h"
#include "base/sys_info.h"
#include "skia/ext/platform_canvas.h"
@@ -65,7 +66,10 @@ bool TransportDIB::is_valid(Handle dib) {
}
skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
- return new skia::PlatformCanvas(w, h, true, handle());
+ scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas);
+ if (!canvas->initialize(w, h, true, handle()))
+ return NULL;
+ return canvas.release();
}
void* TransportDIB::memory() const {