am 245cb784: am 84c924a6: Merge "Replace several IPCThreadState::get() lookups with one." into gingerbread

Merge commit '245cb7846c82f7c0840e13f0b994d356846b1678'

* commit '245cb7846c82f7c0840e13f0b994d356846b1678':
  Replace several IPCThreadState::get() lookups with one.
This commit is contained in:
Brad Fitzpatrick 2010-07-27 14:04:14 -07:00 committed by Android Git Automerger
commit b8f4015c0a
2 changed files with 13 additions and 9 deletions

View File

@ -26,11 +26,12 @@
// ---------------------------------------------------------------------------
namespace android {
class Flattenable;
class IBinder;
class IPCThreadState;
class ProcessState;
class String8;
class TextOutput;
class Flattenable;
struct flat_binder_object; // defined in support_p/binder_module.h
@ -61,10 +62,13 @@ public:
// Parses the RPC header, returning true if the interface name
// in the header matches the expected interface from the caller.
// If strict_policy_out is non-NULL, the RPC header's StrictMode policy
// mask is returned.
//
// Additionally, enforceInterface does part of the work of
// propagating the StrictMode policy mask, populating the current
// IPCThreadState, which as an optimization may optionally be
// passed in.
bool enforceInterface(const String16& interface,
int32_t* strict_policy_out = NULL) const;
IPCThreadState* threadState = NULL) const;
bool checkInterface(IBinder*) const;
void freeData();

View File

@ -458,13 +458,13 @@ bool Parcel::checkInterface(IBinder* binder) const
}
bool Parcel::enforceInterface(const String16& interface,
int32_t* strict_policy_out) const
IPCThreadState* threadState) const
{
int32_t strict_policy = readInt32();
IPCThreadState::self()->setStrictModePolicy(strict_policy);
if (strict_policy_out != NULL) {
*strict_policy_out = strict_policy;
int32_t strictPolicy = readInt32();
if (threadState == NULL) {
threadState = IPCThreadState::self();
}
threadState->setStrictModePolicy(strictPolicy);
const String16 str(readString16());
if (str == interface) {
return true;