The example was helpful. Encapsulating the Persistent in the callacks
private data object seems to be the way to roll.
> // kParameter will pass a void* parameter back to the callback,
> kInternalFields
> // will pass the first two internal fields back to the callback, kFinalizer
> // will p
With recent versions of v8 the SetWeak method has changed and the
Persistent* parameter has been dropped from the destructor callback.
The destructor callback function is **supposed** to Reset() the persistent
or its a leak.
If you don't V8 crashes and tells you this:
Check failed: Handle not re
I found a fix. See the bug comments for how to fix V8
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving
I just found this:
https://bugs.chromium.org/p/v8/issues/detail?id=7670
I'm pretty sure that change broke my code.
How do I back this change out of current sources to get things working
again?
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
Y
After upgrading to a newer version of V8 the constructorFunctionHandler I
set with SetCallAsFunctionHandler does not seem to be working. When I try
to execute the code below it produces this error:
TypeError: RemoteRequest is not a constructor
This sample code is unstructured and ugly, but it w
Did a little more googling and found this option for the args.gn file:
v8_monolithic = true
is_debug = true
is_clang = false
v8_target_cpu = "x64"
target_cpu = "x64"
v8_enable_backtrace = true
v8_enable_slow_dchecks = true
v8_optimized_debug = false
is_component_build = false
v8_static_library = t
I like the idea of a single library.
I tried the following based on the instructions I saw:
ninja -C out.gn/x64.debug v8_monolith
but got this error:
ninja: Entering directory `out.gn/x64.debug'
ninja: error: unknown target 'v8_monolith'
>
>>
--
--
v8-users mailing list
v8-users@googlegro
I tried linking in the v8_init.lib file to my project.
The same error still exists but under another library?
1>v8_init.lib(setup-isolate-full.obj) : error LNK2019: unresolved external
symbol "protected: static void __cdecl
v8::internal::SetupIsolateDelegate::SetupBuiltinsInternal(class
v8::int
Here's the build command i'm using:
ninja -C out.gn/x64.debug
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop r
Trying to get the latest version of V8 on windows to successfully link with
my application.
I've got VC 2017 on a Windows 7 box.
I'm trying to build an x64 debug static library.
I've managed to get V8 to build but I'm running into the following linker
errors:
1>v8_base_1.lib(isolate.obj) : erro
Do I need an handle scope when I work on the Local?
Not sure what that would do for me.
Thanks,
Mike
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To
Do you mean something like this?
Persistent obj;
obj.Reset(pIsolate, blah->NewInstance());
Handle objLocal = obj.Get(pIsolate);
objLocal->SetInternalField(0, External::New(pIsolate, ));
objLocal->SetInternalField(1, External::New(pIsolate, ));
obj.SetWeak(myPointer, MyCl
I've upgraded from a slightly older version of V8.
I can no longer do this with a Persistent
*obj->SetInternalField(0, External::New(pIsolate, ));*
*error C2039: 'SetInternalField': is not a member of
'v8::Persistent>'*
*1>with*
*1>[*
*1>T=v8::Object*
*1>
Also the *v8_base.lib* or any other .lib files we not created.
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop r
At the very end of the build I received this error:
*C:\Dev\common\v8>ninja -C out.gn/x64.release*
*ninja: Entering directory `out.gn/x64.release'*
*[1/7] LINK cctest.exe cctest.exe.pdb*
*FAILED: cctest.exe cctest.exe.pdb*
*ninja -t msvc -e environment.x64 --
../../third_party/llvm-build/Release+
I didn't see you post until now.
I solved the issue running this:
C:\Dev\common\v8\tools\clang\scripts>*python.bat update.py*
Which brought down all the bin files I needed into *third_party/llvm-build*
and now it's compiling!
>
>
--
--
v8-users mailing list
v8-users@googlegroups.com
http://gr
Oh and I've tried running: *gclient sync *from my v8 directory:
C:\Dev\common\v8>gclient sync
C:\Dev\common\.gclient_entries missing, .gclient file in parent directory
C:\Dev\common might not be the file you want to use.
and it doesn't seem to bring down *third_party/llvm-build*
Should it??
What
I'm trying to build V8 as a static library using Visual Studio 2017
(apparently 2017 is now required). I've done it in the past with VC 2015
successfully.
After setting many environment variables and paths and following all the
instructions multiple times it still won't work.
I've got this in m
Are you building & debugging with the Visual Studio IDE?
Using a Visual Studio solution (.sln) file?
I'm still on VS2013 and would LOVE to be able to use the IDE over DOS ninja
commands.
Can you point me to those instructions on how to make this happen?
Thanks a lot!
--
--
v8-users mailing l
I've got a server side implementation which uses multiple threads and a
pool of Isolates.
I've had unexplained V8 memory growth issues for a long time now which
forces me to bounce the service every night.
If V8 has any thread cleanup problem's I for one would love to see that
fixed ASAP.
I don'
Found another bug in Eternal.
The IsEmpty() method is returning an inverted value.
Broken code:
V8_INLINE(bool IsEmpty()) { return index_ != kInitialValue; }
Should be:
V8_INLINE(bool IsEmpty()) { return index_ == kInitialValue; }
Here is the bug report:
https://code.google.com/p/v8/issues/deta
Would it be possible to add a ToLocal() method to the Persistent class?
That would make life much easier to the embedder.
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
> You need a Local not a Persistent.
1st question is why? It's seems like needless complexity.
2nd question is what is the "correct" way to do this?
I've got many situations where I can no longer pass in a Persistent and
must make a "Local" of various types like:
Persistent
It seems that recent changes to Persistent have broken a simple use case.
This example no longer compiles since Persistent is no longer derived from
Handle.
What am I missing??
Persistent ctx;
Context::Scope context_scope(ctx); <-- won't compile.
cannot convert parameter 1 from 'v8::Persistent
Thanks, I'll try it.
I was looking for the *ToFunction()* method...
I didn't know *As()* even existed.
Recent changes have broke pretty much everything I've ever done with V8.
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this me
I could except the function argument to the execut method is optional.
If the argument exists I covert it. Otherwise I don't
Using the explicit constructor would cause a scoping issue.
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received
How do I convert an incoming argument to a Local?
It's basically a script progress callback function that I need to fire in
the calling script.
See the following stripped down example code in yellow which used to work:
void
MyObject_execute(const FunctionCallbackInfo& args)
{
Local funcProgre
Dan,
I think something is broken in the new Eternal API.
This example code block fails to compile.
Seems ObjectTemplate is missing a Cast method?
Eternal eternal;
Local tmplXFile;
tmplXFile = eternal.Get(pIsolate);
eternal.Set(pIsolate, tmplXFile);
V8\include\v8.h(406) : error C2039:
It's getting clearer but less useful.
So the Eternal object stores the index for me. Right?
Doesn't that mean I have to now keep the Eternal object around in my code?
How is keeping an Eternal around better than keeping a Persistent around?
It would be nice if the user could specify the unique in
Can I still do this?
Local local = // some v8 code
index = local.Eternalize(isolate);
Local local = Local::GetEternal(isolate, eternal_index);
In other words how does the new Eternal get loaded/saved?
Eternal eternal;
The original design is really easy and simple. The Isolate store
Dan,
Can you provide a complete example of creating a ObjectTemplate with
eternal, storing it and then later retrieving it?
Something is escaping me...
Thanks!
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because
Dan,
Did the new Eternal land yet?
I'm porting code now and would like to use it.
Mike M.
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscr
I got it to compile by adding the stuff in yellow (don't know if will work
however)
THIS:
obj.MakeWeak(pIsolate, pFile, JSLogFile_DestructorCallback);
TO THIS:
obj.MakeWeak<*v8::Value, RJSLogFile*>(pIsolate, pFile,
RJSLogFile::JSLogFile_DestructorCallback);
So it seams MakeWeak needs some e
Ah. That's better than void anyway.
Made the change. Still errors out.
Seems P * isn't matching RJSLogFile* ??
What other magic do I need to declare this properly?
Some template love?
static void JSLogFile_DestructorCallback(Isolate* env, Persistent*
value, RJSLogFile* pLogFile);
error C2664:
Seems the Persistent::MakeWeak has changed.
I can't figure out how to fix it.
static void JSLogFile_DestructorCallback(Isolate* env, Persistent*
value, void* pNative);
...
obj.MakeWeak(pIsolate, pFile, JSLogFile_DestructorCallback); < THIS
LINE FAILS TO COMPILE
error C2664: 'void v8::Pers
Honestly right now persistent is so hard to use his suggestion would be
welcome. Making the end user build his own ref counting scheme around
Persistent is not better IMO.
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message
I think that's a GREAT idea!
I was planning on sticking my Persistent in a ref counted object.
Why not add this to Persistent instead?
Seems like this idea solves lots of problems.
How many does it create?
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-u
I know this may sound stupid... but how can I kill an eternal?
Really nothing lives forever.
I can think of a case where i might want to destroy one.
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subsc
255 isn't a very big number. For debugging purposes its almost nicer a
have a string (i.e. Ben's BABE below)
Numbers are harder on the eyes and less meaningful.
On Monday, August 5, 2013 5:56:56 AM UTC-5, Dan Carney wrote:
>
> Hi all,
>
> is anyone using more than a few bits of the Persistent::
Good.
Will we be able to copy persistent? In my case I have to be able to pass
around a persistent and store it in several places at a time.
Or should I wrap it in another object and ref count it myself?
On Thu, Aug 1, 2013 at 12:00 PM, Dan Carney wrote:
> Sort of a mine field...
>>
>>
> It abs
Dan,
When do you think the Persistent changes will be complete??
Its hard to wait. Without all the features in there it's hard to use.
Sort of a mine field...
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because yo
Thanks for your help.
Something isn't quite right in my head yet.
Can you take my code snippet and re-compile it with your changes (gnarly
ones too)?
I think there are more errors yet in there.
Thank you!
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-
I've got a simple example in yellow below of using Persistent that is
broken with the recent API changes.
Can somebody tell me how to re-write this so that it will compile with the
new API changes?
I'm a tad lost on how to make it work...
I'm seeing many errors now:
error C2664: 'v8::Persistent
"But it's not going to be at the v8 level." A few years back one of the v8
> devs said (in a post on this list, but i have no link handy) that v8 does
> not gc at shutdown because (i'm paraphrasing), "it negatively impacts
> Chrome's shutdown time." i think most of us will agree that shutting
Your specific problem is easily solved with ref-counted objects on the C++
side. I've done exactly this with your same use case. It works fine.
Please lets move the problem forward in a positive manner.
This is a problem that absolutely can and NEEDS to be solved.
--
--
v8-users mailing li
Sven,
This problem keeps biting embedders over and over and over.
Even if Chrome does not need it...
The rest of the world needs a way to GUARANTEE that C++ backed JS objects
get destroyed in a reliable and predicable manner.
There are many hacks people use to try to get weak callbacks to fire.
After digging into object construction using FunctionTemplate or
ObjectTemplate in this post:
https://groups.google.com/forum/?fromgroups=#!topic/v8-users/521aXb3Uer4
I believe the ObjectTemplate is missing a HasInstance() method for use in
testing arguments to JS functions to be of a certain t
Ben,
Can you expand on your example?
I'm sure this is piece of cake for you, but I'm not getting what you mean.
All the samples I can find show using ObjectTemplate and the
SetCallAsFunctionHandler() to handle construction from the C++ side.
var o = new MyObject();
var x = new MyObject();
o.doS
Why?
Because I can't find a complete example of how to do it any other way...
I need more then a two line explanation. The lack of quality documentation
and straight forward examples is outstanding.
All the examples use ObjectTemplates. The embedders guide does too.
Also the object I'm creatin
If I use the FunctionTemplate instead of the ObjectTemplate I can't seem to
get a constructor callback to work.
funcTemplate->InstanceTemplate()->SetCallAsFunctionHandler(ctorCallback);
When the script does this:
var o = new MyObject();
The C++ ctorCallback is never called!
Why doesn't the Obj
I tried to use a FunctionTemplate for the object.
Howerver, the FunctionTemplate does not have SetCallAsFunctionHandler()
which I need to construct the object..
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because y
I originally created an ObjectTemplate which I also Set() in another
ObjectTemplate used as argument to Context::New()
It appears ObjectTemplate can't do HasInstance().
When should I use the FunctionTemplate versus ObjectTemplate??
It's a tad confusioning...
--
--
v8-users mailing list
v8-user
If I have an object I injected into the global using an ObjectTemplate.
The user creates one in script like this:
var o = new MyObject();
That fires my SetCallAsFunctionHandler() which creates the object using the
ObjectTemplate and NewInstance() and passes it back to javascript land.
Now the s
If this belongs in the v8-dev group please let me know.
I have a pool of Isolates that I manage and use to run scripts on various
threads.
I'm using Lockers, scopes etc... appropriately. The scripts are running
great.
However, at service shutdown time I iterate the Isolates and destroy them
o
I solved it.
In my actual code I was simple using the wrong argument. Doh!
argv[2] instead of argv[1].
Feeling really stupid...
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google
It seems that after saving off a Persistent copy of the function V8 doesn't
think its a function anymore!
ASSERT(args[0]->IsFunction()); <-- This works.
Local funcProgress;
*funcProgress = Function::Cast(*args[0]);*
Persistent fnProgressCallack =
Persistent::New(args.GetIsolate(), funcProgre
In the V8 sources the Call() method is throwing an exception.
IsJSFunction() is returning false and TryGetFunctionDelegate() is setting a
pending exception.
execution.cc line 283.
if (!callable->IsJSFunction()) {
callable = TryGetFunctionDelegate(callable, pending_exception);
if (*pendin
The script code should be:
*myObj.setProgressCallback(OnProgress); //Tell it how to call us back...*
There is no -> operator in javascript!
Its still not working however.
See native C++ code below.
Does that line in RED look correct?
There is no ToFunction() method on args[0] so I did an ugly c
I'm trying to do a simple callback into a JS script.
The script does something like this:
function OnProgress(percent) {
//Do something
}
myObj->setProgressCallback(OnProgress); //Tell it how to call us back...
My native C++ code stores the function passed to setProgressCallback in a
Persi
I embed V8 in my application(s).
No shell or chromium etc..
V8 is a static library linked into my applications.
What magic does *--allow-natives-syntax* do v8 or chromium?
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this messag
I'm using Visual Studio to build V8.
Note sure where/how --allow-natives-syntax comes into play.
Ideas?
--
--
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group
Don't use sleep(). Use WaitForSingleObject() instead with a timeout equal
to the number of seconds you want to sleep.
Wait on an event that is never signaled unless your thread is being
terminated.
HANDLE hSleepEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
//Here's how you do the sleep
WaitFo
I'm looking for a simple piece of code that can take a V8 Global Object and
dump out all its properties.
Basically iterate the global and print out a listing of every property and
object by name and type information.
This is for debugging an issue where the engine says a property doesn't
exist
The method is basically a Getter(). Has no purpose other than to change the
Primitive value coming in to another value.
I need a SetData() and GetData() method to change the underlying Persistent
Primitive to another Primitive.
If stored value should not be:
v8::Persistent m_Value;
What shoul
I'm using V8 javascript engine and storing some values in a C++ object
using this:
v8::Persistent m_Value;
I want to use the saved value to set another Primitive and return it like
this:
bool
MyClass::Convert(v8::Primitive& oValue)
{
oValue.Clear();//Clear() is not a valid method
On Oct 8, 2010 1:56 AM, "Vincent Han" wrote:
> Hi all
>
> I'm studying V8 Debug protocol using Android 2.2
>
> Protocol processing between Chromium and ChromDevTools is like
> below(only v8 protocol)
>>> request command:version
> << response of req (version)
>>> request command:scripts arg:include
66 matches
Mail list logo