Index: tests/fake_browser_ppapi/fake_instance.cc |
diff --git a/tests/fake_browser_ppapi/fake_instance.cc b/tests/fake_browser_ppapi/fake_instance.cc |
index 8d317bb8e8045791177c9a0da1ae68672c9f196b..4bfbb23a53b38559144466a898c231140b7b1764 100644 |
--- a/tests/fake_browser_ppapi/fake_instance.cc |
+++ b/tests/fake_browser_ppapi/fake_instance.cc |
@@ -19,67 +19,68 @@ namespace fake_browser_ppapi { |
namespace { |
-static Instance* GetInstancePointer(PP_Instance instance) { |
- return reinterpret_cast<Instance*>(static_cast<uintptr_t>(instance)); |
-} |
- |
static PP_Var GetWindowObject(PP_Instance instance) { |
- return GetInstancePointer(instance)->GetWindowObject(); |
+ return GetInstance(instance)->GetWindowObject(); |
} |
static PP_Var GetOwnerElementObject(PP_Instance instance) { |
- return GetInstancePointer(instance)->GetOwnerElementObject(); |
+ return GetInstance(instance)->GetOwnerElementObject(); |
} |
static PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) { |
- return |
- static_cast<PP_Bool>(GetInstancePointer(instance)->BindGraphics(device)); |
+ return static_cast<PP_Bool>(GetInstance(instance)->BindGraphics(device)); |
} |
static PP_Bool IsFullFrame(PP_Instance instance) { |
- return static_cast<PP_Bool>(GetInstancePointer(instance)->IsFullFrame()); |
+ return static_cast<PP_Bool>(GetInstance(instance)->IsFullFrame()); |
} |
static PP_Var ExecuteScript(PP_Instance instance, |
PP_Var script, |
PP_Var* exception) { |
- return GetInstancePointer(instance)->ExecuteScript(script, exception); |
+ return GetInstance(instance)->ExecuteScript(script, exception); |
} |
} // namespace |
+Instance Instance::kInvalidInstance; |
+ |
PP_Var Instance::GetWindowObject() { |
- DebugPrintf("Instance::GetWindowObject: instance=%p\n", |
- reinterpret_cast<void*>(this)); |
- return window_->FakeWindowObject(); |
+ DebugPrintf("Instance::GetWindowObject: instance=%"NACL_PRId32"\n", |
+ instance_id_); |
+ if (window_) |
+ return window_->FakeWindowObject(); |
+ else |
+ return PP_MakeUndefined(); |
} |
PP_Var Instance::GetOwnerElementObject() { |
- DebugPrintf("Instance::GetOwnerElementObject: instance=%p\n", |
- reinterpret_cast<void*>(this)); |
+ DebugPrintf("Instance::GetOwnerElementObject: instance=%"NACL_PRId32"\n", |
+ instance_id_); |
NACL_UNIMPLEMENTED(); |
return PP_MakeUndefined(); |
} |
bool Instance::BindGraphics(PP_Resource device) { |
- DebugPrintf("Instance::BindGraphicsDeviceContext: instance=%p" |
- ", device=%"NACL_PRIu64"\n", |
- reinterpret_cast<void*>(this), device); |
+ DebugPrintf("Instance::BindGraphicsDeviceContext: instance=%"NACL_PRId32"\n", |
+ ", device=%"NACL_PRIu32"\n", |
+ instance_id_, |
+ device); |
NACL_UNIMPLEMENTED(); |
return false; |
} |
bool Instance::IsFullFrame() { |
- DebugPrintf("Instance::IsFullFrame: instance=%p\n", |
- reinterpret_cast<void*>(this)); |
+ DebugPrintf("Instance::IsFullFrame: instance=%"NACL_PRId32"\n", |
+ instance_id_); |
NACL_UNIMPLEMENTED(); |
return false; |
} |
PP_Var Instance::ExecuteScript(PP_Var script, |
PP_Var* exception) { |
- DebugPrintf("Instance::ExecuteScript: instance=%p\n", |
- reinterpret_cast<void*>(this)); |
+ DebugPrintf("Instance::ExecuteScript: instance=%"NACL_PRId32"\n", |
+ instance_id_); |
NACL_UNIMPLEMENTED(); |
UNREFERENCED_PARAMETER(script); |
UNREFERENCED_PARAMETER(exception); |