Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: skia/ext/platform_canvas_win.cc

Issue 14903: Reverting 7318. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/platform_canvas_win.h ('k') | skia/ext/platform_device_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/platform_canvas_win.cc
===================================================================
--- skia/ext/platform_canvas_win.cc (revision 7318)
+++ skia/ext/platform_canvas_win.cc (working copy)
@@ -2,14 +2,17 @@
// 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
@@ -23,21 +26,21 @@
// 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.
- scoped_ptr<base::ProcessMetrics> process_metrics(
- base::ProcessMetrics::CreateProcessMetrics(GetCurrentProcess()));
- CHECK(process_metrics->GetPagefileUsage() < kLotsOfMem);
+ const __int64 kLotsOfMem = 1500000000; // 1.5GB.
+ PROCESS_MEMORY_COUNTERS pmc;
+ if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)))
+ CHECK(pmc.PagefileUsage < kLotsOfMem);
// Everything else.
CHECK(0);
}
-
PlatformCanvasWin::PlatformCanvasWin() : SkCanvas() {
}
@@ -94,7 +97,7 @@
int width,
int height,
bool is_opaque, bool isForLayer) {
- DCHECK(config == SkBitmap::kARGB_8888_Config);
+ SkASSERT(config == SkBitmap::kARGB_8888_Config);
return createPlatformDevice(width, height, is_opaque, NULL);
}
@@ -110,7 +113,7 @@
}
SkDevice* PlatformCanvasWin::setBitmapDevice(const SkBitmap&) {
- NOTREACHED();
+ SkASSERT(false); // Should not be called.
return NULL;
}
« no previous file with comments | « skia/ext/platform_canvas_win.h ('k') | skia/ext/platform_device_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698