diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-19 21:22:31 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-19 21:22:31 +0000 |
commit | 83d36f001d591d153b3442e9d0f3739ee984469a (patch) | |
tree | 34b782a4665736d8cc2a11f0806f13aa4c765919 /skia/ext/platform_canvas_win.cc | |
parent | 0026e48d1cf39bac65875fba6f5d38eb550a22f9 (diff) | |
download | chromium_src-83d36f001d591d153b3442e9d0f3739ee984469a.zip chromium_src-83d36f001d591d153b3442e9d0f3739ee984469a.tar.gz chromium_src-83d36f001d591d153b3442e9d0f3739ee984469a.tar.bz2 |
Reverting 7317.
Review URL: http://codereview.chromium.org/15089
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7318 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/platform_canvas_win.cc')
-rw-r--r-- | skia/ext/platform_canvas_win.cc | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/skia/ext/platform_canvas_win.cc b/skia/ext/platform_canvas_win.cc index 85a6b6d..4062d7b 100644 --- a/skia/ext/platform_canvas_win.cc +++ b/skia/ext/platform_canvas_win.cc @@ -2,17 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <psapi.h> - #include "skia/ext/platform_canvas_win.h" +#include "base/logging.h" +#include "base/process_util.h" #include "skia/ext/bitmap_platform_device_win.h" namespace skia { -// Crash on failure. -#define CHECK(condition) if (!(condition)) __debugbreak(); - // Crashes the process. This is called when a bitmap allocation fails, and this // function tries to determine why it might have failed, and crash on different // lines. This allows us to see in crash dumps the most likely reason for the @@ -26,21 +23,21 @@ void CrashForBitmapAllocationFailure(int w, int h) { // If the bitmap is ginormous, then we probably can't allocate it. // We use 64M pixels = 256MB @ 4 bytes per pixel. - const __int64 kGinormousBitmapPxl = 64000000; - CHECK(static_cast<__int64>(w) * static_cast<__int64>(h) < - kGinormousBitmapPxl); + const int64 kGinormousBitmapPxl = 64000000; + CHECK(static_cast<int64>(w) * static_cast<int64>(h) < kGinormousBitmapPxl); // If we're using a crazy amount of virtual address space, then maybe there // isn't enough for our bitmap. - const __int64 kLotsOfMem = 1500000000; // 1.5GB. - PROCESS_MEMORY_COUNTERS pmc; - if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) - CHECK(pmc.PagefileUsage < kLotsOfMem); + const int64 kLotsOfMem = 1500000000; // 1.5GB. + scoped_ptr<base::ProcessMetrics> process_metrics( + base::ProcessMetrics::CreateProcessMetrics(GetCurrentProcess())); + CHECK(process_metrics->GetPagefileUsage() < kLotsOfMem); // Everything else. CHECK(0); } + PlatformCanvasWin::PlatformCanvasWin() : SkCanvas() { } @@ -97,7 +94,7 @@ SkDevice* PlatformCanvasWin::createDevice(SkBitmap::Config config, int width, int height, bool is_opaque, bool isForLayer) { - SkASSERT(config == SkBitmap::kARGB_8888_Config); + DCHECK(config == SkBitmap::kARGB_8888_Config); return createPlatformDevice(width, height, is_opaque, NULL); } @@ -113,7 +110,7 @@ SkDevice* PlatformCanvasWin::createPlatformDevice(int width, } SkDevice* PlatformCanvasWin::setBitmapDevice(const SkBitmap&) { - SkASSERT(false); // Should not be called. + NOTREACHED(); return NULL; } |