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

Side by Side Diff: tests/DiscardableMemoryTest.cpp

Issue 83563002: Implement SkAshmemDiscardableMemory (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: final rebase Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/CachedDecodingPixelRefTest.cpp ('k') | tools/LazyDecodeBitmap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkDiscardableMemory.h"
9
10 #include "Test.h"
11 #include "TestClassDef.h"
12
13 DEF_TEST(DiscardableMemory, reporter) {
14 const char testString[] = "HELLO, WORLD!";
15 const size_t len = sizeof(testString);
16 SkAutoTDelete<SkDiscardableMemory> dm(SkDiscardableMemory::Create(len));
17 REPORTER_ASSERT(reporter, dm.get() != NULL);
18 if (NULL == dm.get()) {
19 return;
20 }
21 void* ptr = dm->data();
22 REPORTER_ASSERT(reporter, ptr != NULL);
23 memcpy(ptr, testString, sizeof(testString));
24 dm->unlock();
25 bool success = dm->lock();
26 REPORTER_ASSERT(reporter, success);
27 if (!success) {
28 return;
29 }
30 ptr = dm->data();
31 REPORTER_ASSERT(reporter, 0 == memcmp(ptr, testString, len));
32 dm->unlock();
33 }
34
OLDNEW
« no previous file with comments | « tests/CachedDecodingPixelRefTest.cpp ('k') | tools/LazyDecodeBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698