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

Unified Diff: ppapi/proxy/serialized_structs.cc

Issue 11359097: Refactored the PPB_Flash_File_ModuleLocal/FileRef to the new ppapi resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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: ppapi/proxy/serialized_structs.cc
diff --git a/ppapi/proxy/serialized_structs.cc b/ppapi/proxy/serialized_structs.cc
index f83ae0b95c67e92ac42493c5fbd713235276e34c..2ddf32599424f354f8bf3ed79c7b6cc348928c25 100644
--- a/ppapi/proxy/serialized_structs.cc
+++ b/ppapi/proxy/serialized_structs.cc
@@ -107,10 +107,17 @@ SerializedHandle::SerializedHandle(
}
bool SerializedHandle::IsHandleValid() const {
- if (type_ == SHARED_MEMORY)
- return base::SharedMemory::IsHandleValid(shm_handle_);
- else if (type_ == SOCKET || type_ == CHANNEL_HANDLE)
- return !(IPC::InvalidPlatformFileForTransit() == descriptor_);
+ switch (type_) {
+ case SHARED_MEMORY:
+ return base::SharedMemory::IsHandleValid(shm_handle_);
+ case SOCKET:
+ case CHANNEL_HANDLE:
+ case FILE:
+ return !(IPC::InvalidPlatformFileForTransit() == descriptor_);
+ case INVALID:
+ return false;
+ // No default so the compiler will warn us if a new type is added.
+ }
return false;
}
@@ -125,6 +132,7 @@ void SerializedHandle::Close() {
break;
case SOCKET:
case CHANNEL_HANDLE:
+ case FILE:
base::PlatformFile file =
IPC::PlatformFileForTransitToPlatformFile(descriptor_);
#if !defined(OS_NACL)
@@ -168,6 +176,7 @@ bool SerializedHandle::ReadHeader(PickleIterator* iter, Header* hdr) {
}
case SOCKET:
case CHANNEL_HANDLE:
+ case FILE:
case INVALID:
valid_type = true;
break;

Powered by Google App Engine
This is Rietveld 408576698