Hi Mike,
On Wed, Oct 1, 2008 at 1:02 PM, Mike Belshe <[EMAIL PROTECTED]> wrote:
>
> Generally, I don't think you should touch the bridge (btw - the bridge is
> going away as we reconcile differences w/ webkit- it will be the
> scriptController, I believe).
>
> I don't have source in front of me; but there is a file like "np_v8_util"
> or np_v8_object" where there are some conversion utilities for converting v8
> types to NPObjects. This routine (v8array to NPObject) probably belongs in
> there (for v8). I'm fairly clueless about the JSC code. (we used to refer
> to JavaScriptCore as KJS; but we now refer to it as JSC since that is the
> proper name)
>
> I'd assume that you'd create the NPObject direct from the CppBoundClass by
> calling this function. The last problem is making your newly created object
> reachable from your JS code; and for that, I think there is a BindToXXXX
> call (I believe it is on the bridge), which allows you to hang a custom
> property off the window object.
>
> While you described what you are trying to do (make arrays from C++
> accessible to JS), I need more context to understand the best way to hook
> into the system. Are you augmenting an existing CppBoundObject? Or
> creating something new?
>
> Mike
>
Sorry for not being clear -- I posted about this in a separate message on
the chromium-dev list about a week ago. The overall goal is to add the
following methods to the existing webkit/glue/CppVariant class in the least
intrusive manner possible. The new JS Array NPObject would be created in
the Set() methods and assigned to the NPVariant underlying the CppVariant
instance.
// Methods for assigning vectors of different data types
void Set(const std::vector<std::wstring>& value);
void Set(const std::vector<int32_t>& value);
void Set(const std::vector<double>& value);
void Set(const std::vector<bool>& value);
// Evaluate the elements in the NPObject and determine
// the most appropriate vector data type to use.
enum VectorType {
VECTOR_TYPE_STRING,
VECTOR_TYPE_INT32,
VECTOR_TYPE_DOUBLE,
VECTOR_TYPE_BOOLEAN
};
VectorType GetVectorTypeHint() const;
// Methods for retrieving vectors of different data types
std::vector<std::wstring> ToStringVector() const; // this method already
exists
std::vector<int32_t> ToInt32Vector() const;
std::vector<double> ToDoubleVector() const;
std::vector<bool> ToBooleanVector() const;
Adding these methods will make it easier to use JS array objects as
arguments and return values for CppBoundClass callback functions.
I see that, as you mentioned, JSBridge will disappear with the pending
chrome_webkit_merge_branch merge. It was supposed to land on trunk
yesterday, but I guess it got postponed? In any case, I'll look around in
chrome_webkit_merge_branch and try to identify the appropriate place to add
the CreateSimpleArrayObject() methods that will do the actual NPObject
creation work.
Regards,
Marshall
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Chromium-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/chromium-dev?hl=en
-~----------~----~----~----~------~----~------~--~---