Reviewers: acleung,

Description:
Fix Chrome plugin compile errors by replacing "Value" with "gwt::Value".


Please review this at http://gwt-code-reviews.appspot.com/1835803/

Affected files:
  M plugins/npapi/NPVariantWrapper.h
  M plugins/npapi/ScriptableInstance.cpp
  M plugins/npapi/ScriptableInstance.h


Index: plugins/npapi/NPVariantWrapper.h
===================================================================
--- plugins/npapi/NPVariantWrapper.h    (revision 11274)
+++ plugins/npapi/NPVariantWrapper.h    (working copy)
@@ -98,13 +98,13 @@
     return NPVariantUtil::getAsNPString(variant);
   }

- Value getAsValue(ScriptableInstance& scriptInstance, bool unwrapJava = true) const { + gwt::Value getAsValue(ScriptableInstance& scriptInstance, bool unwrapJava = true) const {
     return getAsValue(variant, scriptInstance, unwrapJava);
   }

- static Value getAsValue(const NPVariant& variant, ScriptableInstance& scriptInstance, + static gwt::Value getAsValue(const NPVariant& variant, ScriptableInstance& scriptInstance,
       bool unwrapJava = true) {
-    Value val;
+    gwt::Value val;
     if (NPVARIANT_IS_VOID(variant)) {
       val.setUndefined();
     } else if (NPVARIANT_IS_NULL(variant)) {
@@ -218,12 +218,12 @@
     assignFrom(variant, newvar);
   }

-  NPVariantProxy& operator=(const Value& newval) {
+  NPVariantProxy& operator=(const gwt::Value& newval) {
     assignFrom(plugin, variant, newval);
     return *this;
   }

- static void assignFrom(ScriptableInstance& plugin, NPVariant& variant, const Value& newval) { + static void assignFrom(ScriptableInstance& plugin, NPVariant& variant, const gwt::Value& newval) {
     NPVariant newvar;
     VOID_TO_NPVARIANT(newvar);
     if (newval.isBoolean()) {
@@ -431,7 +431,7 @@
     return NPVariantUtil::getAsNPString(variant);
   }

- Value getAsValue(ScriptableInstance& scriptInstance, bool unwrapJava = true) const { + gwt::Value getAsValue(ScriptableInstance& scriptInstance, bool unwrapJava = true) const {
     return NPVariantProxy::getAsValue(variant, scriptInstance, unwrapJava);
   }

@@ -445,7 +445,7 @@
     return *this;
   }

-  NPVariantWrapper& operator=(const Value& newval) {
+  NPVariantWrapper& operator=(const gwt::Value& newval) {
     NPVariantProxy::assignFrom(plugin, variant, newval);
     return *this;
   }
Index: plugins/npapi/ScriptableInstance.cpp
===================================================================
--- plugins/npapi/ScriptableInstance.cpp        (revision 11274)
+++ plugins/npapi/ScriptableInstance.cpp        (working copy)
@@ -126,11 +126,11 @@
   return false;
 }

-bool ScriptableInstance::makeResult(bool isException, const Value& value, NPVariant* result) { +bool ScriptableInstance::makeResult(bool isException, const gwt::Value& value, NPVariant* result) { Debug::log(Debug::Debugging) << "makeResult(" << isException << ", " << value << ")"
       << Debug::flush;
-  Value temp;
-  if (value.getType() == Value::JAVA_OBJECT) {
+  gwt::Value temp;
+  if (value.getType() == gwt::Value::JAVA_OBJECT) {
     int javaId = value.getJavaObjectId();
     // We may have previously released the proxy for the same object id,
     // but have not yet sent a free message back to the server.
@@ -498,14 +498,14 @@
   }
 }

-Value ScriptableInstance::clientMethod_getProperty(HostChannel& channel, int numArgs, const Value* const args) { +gwt::Value ScriptableInstance::clientMethod_getProperty(HostChannel& channel, int numArgs, const gwt::Value* const args) { if (numArgs != 2 || !args[0].isInt() || (!args[1].isString() && !args[1].isInt())) { Debug::log(Debug::Error) << "Incorrect invocation of getProperty: #args=" << numArgs << ":";
     for (int i = 0; i < numArgs; ++i) {
       Debug::log(Debug::Error) << " " << i << "=" << args[i].toString();
     }
     Debug::log(Debug::Error) << Debug::flush;
-    return Value();
+    return gwt::Value();
   }
   int id = args[0].getInt();
   NPObject* obj = localObjects.getById(id);
@@ -521,12 +521,12 @@
if (!NPN_GetProperty(getNPP(), obj, propID, npResult.addressForReturn())) {
     Debug::log(Debug::Warning) << "getProperty(id=" << id << ", prop="
         << NPN_UTF8FromIdentifier(propID) << ") failed" << Debug::flush;
-    return Value();
+    return gwt::Value();
   }
   return npResult.getAsValue(*this);
 }

-Value ScriptableInstance::clientMethod_setProperty(HostChannel& channel, int numArgs, const Value* const args) { +gwt::Value ScriptableInstance::clientMethod_setProperty(HostChannel& channel, int numArgs, const gwt::Value* const args) { if (numArgs != 2 || !args[0].isInt() || (!args[1].isString() && !args[1].isInt())) { Debug::log(Debug::Error) << "Incorrect invocation of setProperty: #args="
         << numArgs << ":";
@@ -534,7 +534,7 @@
       Debug::log(Debug::Error) << " " << i << "=" << args[i].toString();
     }
     Debug::log(Debug::Error) << Debug::flush;
-    return Value();
+    return gwt::Value();
   }
   int id = args[0].getInt();
   NPObject* obj = localObjects.getById(id);
@@ -552,9 +552,9 @@
     Debug::log(Debug::Warning) << "setProperty(id=" << id << ", prop="
         << NPN_UTF8FromIdentifier(propID) << ", val=" << args[2].toString()
         << ") failed" << Debug::flush;
-    return Value();
-  }
-  return Value();
+    return gwt::Value();
+  }
+  return gwt::Value();
 }

 /**
@@ -562,7 +562,7 @@
  * requests to invoke methods in Javascript or the plugin.
  */
bool ScriptableInstance::invokeSpecial(HostChannel& channel, SpecialMethodId dispatchId,
-    int numArgs, const Value* const args, Value* returnValue) {
+    int numArgs, const gwt::Value* const args, gwt::Value* returnValue) {
   switch (dispatchId) {
   case SessionHandler::HasMethod:
   case SessionHandler::HasProperty:
@@ -590,9 +590,9 @@
   return true;
 }

-bool ScriptableInstance::invoke(HostChannel& channel, const Value& thisRef,
-    const string& methodName, int numArgs, const Value* const args,
-    Value* returnValue) {
+bool ScriptableInstance::invoke(HostChannel& channel, const gwt::Value& thisRef,
+    const string& methodName, int numArgs, const gwt::Value* const args,
+    gwt::Value* returnValue) {
   Debug::log(Debug::Debugging) << "invokeJS(" << methodName << ", this="
<< thisRef.toString() << ", numArgs=" << numArgs << ")" << Debug::flush;
   NPVariantArray varArgs(*this, numArgs + 2);
@@ -654,14 +654,14 @@
     isRawToString = true;
   }

-  Value javaThis;
+  gwt::Value javaThis;
   javaThis.setJavaObject(objectId);
-  scoped_array<Value> vargs(new Value[numArgs]);
+  scoped_array<gwt::Value> vargs(new gwt::Value[numArgs]);
   for (unsigned i = 0; i < numArgs; ++i) {
     vargs[i] = NPVariantProxy::getAsValue(args[i], *this);
   }
   bool isException = false;
-  Value returnValue;
+  gwt::Value returnValue;
if (!InvokeMessage::send(*_channel, javaThis, dispId, numArgs, vargs.get())) { Debug::log(Debug::Error) << "JavaObject_invoke: failed to send invoke message" << Debug::flush;
   } else {
@@ -688,7 +688,7 @@
   Debug::log(Debug::Debugging) << "JavaObject_getProperty(objectid="
       << objectId << ", dispId=" << dispId << ")" << Debug::flush;
   VOID_TO_NPVARIANT(*result);
- Value propertyValue = ServerMethods::getProperty(*_channel, this, objectId, dispId); + gwt::Value propertyValue = ServerMethods::getProperty(*_channel, this, objectId, dispId);
   if (propertyValue.isJsObject()) {
     // TODO(jat): special-case for testing
     NPObject* npObj = localObjects.getById(propertyValue.getJsObjectId());
@@ -717,7 +717,7 @@
     Debug::log(Debug::Debugging) << "  before localObj: refcount = "
<< NPVariantUtil::getAsObject(*npValue)->referenceCount << Debug::flush;
   }
-  Value value = NPVariantProxy::getAsValue(*npValue, *this, true);
+  gwt::Value value = NPVariantProxy::getAsValue(*npValue, *this, true);
   if (NPVariantUtil::isObject(*npValue)) {
     Debug::log(Debug::Debugging) << "  after localObj: refcount = "
<< NPVariantUtil::getAsObject(*npValue)->referenceCount << Debug::flush;
@@ -734,7 +734,7 @@
Debug::log(Debug::Debugging) << "JavaObject_getToStringTearOff()" << Debug::flush;
   VOID_TO_NPVARIANT(*result);

-  Value temp;
+  gwt::Value temp;
   NPVariantArray varArgs(*this, 3);
   temp.setNull();  varArgs[0] = temp; // proxy: no proxy needed
   temp.setInt(0);  varArgs[1] = temp; // dispId: always 0 for toString()
Index: plugins/npapi/ScriptableInstance.h
===================================================================
--- plugins/npapi/ScriptableInstance.h  (revision 11274)
+++ plugins/npapi/ScriptableInstance.h  (working copy)
@@ -118,14 +118,14 @@
   NPObject* window;
   void dupString(const char* str, NPString& npString);
   void dumpObjectBytes(NPObject* obj);
-  bool makeResult(bool isException, const Value& value, NPVariant* result);
+ bool makeResult(bool isException, const gwt::Value& value, NPVariant* result);

   // SessionHandler methods
-  virtual bool invoke(HostChannel& channel, const Value& thisObj,
-      const std::string& methodName, int numArgs, const Value* const args,
-      Value* returnValue);
+  virtual bool invoke(HostChannel& channel, const gwt::Value& thisObj,
+ const std::string& methodName, int numArgs, const gwt::Value* const args,
+      gwt::Value* returnValue);
virtual bool invokeSpecial(HostChannel& channel, SpecialMethodId dispatchId,
-      int numArgs, const Value* const args, Value* returnValue);
+      int numArgs, const gwt::Value* const args, gwt::Value* returnValue);
virtual void freeValue(HostChannel& channel, int idCount, const int* ids);
   virtual void sendFreeValues(HostChannel& channel);
   virtual void loadJsni(HostChannel& channel, const std::string& js);
@@ -136,8 +136,8 @@
void loadHostEntries(const NPVariant* args, unsigned argCount, NPVariant* result); void getHostPermission(const NPVariant* args, unsigned argCount, NPVariant* result); void testJsIdentity(const NPVariant* args, unsigned argCount, NPVariant* result); - Value clientMethod_getProperty(HostChannel& channel, int numArgs, const Value* const args); - Value clientMethod_setProperty(HostChannel& channel, int numArgs, const Value* const args); + gwt::Value clientMethod_getProperty(HostChannel& channel, int numArgs, const gwt::Value* const args); + gwt::Value clientMethod_setProperty(HostChannel& channel, int numArgs, const gwt::Value* const args);

   void JavaObject_invalidate(int objectId);
   bool JavaObject_invoke(int objectId, int dispId, const NPVariant* args,


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to