LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 127 forks source link

Pre Built Libraries #163

Open ackava opened 4 years ago

ackava commented 4 years ago

This is just for your information, I tried to incorporate V8 Inspector in different project using your source code, I found that pre built libraries do not have inspector related code leading to "Unimplimented code" fatal errors.

Inspector does start, and communication protocol is established. However, compiling and invoking script fails in debugger console.

I didn't make any changes in your code, I just added Inspector related code and since I only wanted V8, I commented all node related cpp files and left the ICU related includes as it is in CMakeList.

Is there anyway these prebuild libraries can include inspector?

ericwlange commented 4 years ago

Are you sure this is the issue?

From android-configure:

    ./configure \
        --dest-cpu=$DEST_CPU \
        --dest-os=android \
        --with-intl=small-icu \
        --openssl-no-asm \
        --cross-compiling \
        --with-snapshot \
        --shared

From configure.py:

def configure_inspector(o):
  disable_inspector = (options.without_inspector or
                       options.with_intl in (None, 'none') or
                       options.without_ssl)
  o['variables']['v8_enable_inspector'] = 0 if disable_inspector else 1

So, theoretically, the inspector has not been disabled in the build. It should only be disabled if ICU or SSL have been disabled, or if --without-inspector was explicitly specified. None of these should be the case.

ackava commented 4 years ago

Sorry, the error wrongly suggested that something was missing, but after digging around the source of v8, I finally found the bug inside V8, here it is.

https://bugs.chromium.org/p/v8/issues/detail?id=8342&q=component%3AInspector&can=2

Node has already fixed it and if you are using same source of node, then you may not face the same error.

But since your liquidv8 project is separate, if you are creating new platform, then default Task runner will give same error. In order to fix it,

  1. You have to create a new platform and wrap v8::Platform::NewDefaultPlatform inside it
  2. Return new wrapped TaskRunner for GetForegroundTaskRunner, GetBackgroundTaskRunner and GetWorkerThreadsTaskRunner.
  3. In new Wrapped TaskRunner, you have to override method PostDelayedTask, you have to either set delay_time parameter to zero or you have to pass your own implementation of putting delay before task execution.

I hope this helps.