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

Unified Diff: src/core/SkOrderedWriteBuffer.cpp

Issue 23021015: Initial error handling code (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: New SkSecureReadBuffer class Created 7 years, 4 months 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
Index: src/core/SkOrderedWriteBuffer.cpp
diff --git a/src/core/SkOrderedWriteBuffer.cpp b/src/core/SkOrderedWriteBuffer.cpp
index 64f52193acaf7c55dab611a5b53f41f13685fd7e..bc2cb648586f7ea8090e8ee8bfa88a36c8c74896 100644
--- a/src/core/SkOrderedWriteBuffer.cpp
+++ b/src/core/SkOrderedWriteBuffer.cpp
@@ -270,7 +270,9 @@ void SkOrderedWriteBuffer::writeFlattenable(SkFlattenable* flattenable) {
factory = flattenable->getFactory();
}
if (NULL == factory) {
- if (fFactorySet != NULL || fNamedFactorySet != NULL) {
+ if (isSecure()) {
sugoi1 2013/08/29 18:55:53 I added these 2 checks to the writer, but, hopeful
reed1 2013/08/29 19:08:22 style nit: this->isSecure()
sugoi1 2013/08/29 19:39:40 Done.
+ this->writeString(NULL);
+ } else if (fFactorySet != NULL || fNamedFactorySet != NULL) {
this->write32(0);
} else {
this->writeFunctionPtr(NULL);
@@ -290,7 +292,14 @@ void SkOrderedWriteBuffer::writeFlattenable(SkFlattenable* flattenable) {
* name. SkGPipe uses this technique so it can write the name to its
* stream before writing the flattenable.
*/
- if (fFactorySet) {
+ if (isSecure()) {
reed1 2013/08/29 19:08:22 style nit: this->isSecure()
sugoi1 2013/08/29 19:39:40 Done.
+ const char* name = SkFlattenable::FactoryToName(factory);
+ this->writeString(name);
+ if (NULL == name) {
+ SkASSERT(!"Missing factory name");
+ return;
+ }
+ } else if (fFactorySet) {
this->write32(fFactorySet->add(factory));
} else if (fNamedFactorySet) {
int32_t index = fNamedFactorySet->find(factory);

Powered by Google App Engine
This is Rietveld 408576698