Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
Chromium
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
Chromium
Commits
e6ffeef8
Commit
e6ffeef8
authored
Jan 06, 2023
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Loader.
parent
2f8f5881
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
36 deletions
+65
-36
bindings.gni
third_party/blink/renderer/bindings/bindings.gni
+6
-6
Loader.cc
third_party/blink/renderer/bindings/core/v8/Loader.cc
+44
-0
loader.h
third_party/blink/renderer/bindings/core/v8/loader.h
+12
-0
nativeBox.cc
third_party/blink/renderer/bindings/core/v8/nativeBox.cc
+2
-0
v8_initializer_custom.cc
.../blink/renderer/bindings/core/v8/v8_initializer_custom.cc
+1
-30
No files found.
third_party/blink/renderer/bindings/bindings.gni
View file @
e6ffeef8
...
...
@@ -146,12 +146,12 @@ blink_core_sources_bindings =
"core/v8/v8_idle_task_runner.h",
"core/v8/v8_initializer.cc",
"core/v8/v8_initializer.h",
"core/v8/v8_initializer_custom.cc",
"core/v8/v8_initializer_custom.h",
"core/v8/nativeBox.h",
"core/v8/nativeBox.cc",
"extensions/loadablemodule/src/Loadable.cc",
"extensions/loadablemodule/src/Loadable.h",
#
"core/v8/v8_initializer_custom.cc",
#
"core/v8/v8_initializer_custom.h",
#
"core/v8/nativeBox.h",
#
"core/v8/nativeBox.cc",
#
"extensions/loadablemodule/src/Loadable.cc",
#
"extensions/loadablemodule/src/Loadable.h",
"core/v8/v8_intersection_observer_delegate.cc",
"core/v8/v8_intersection_observer_delegate.h",
"core/v8/v8_iterator_result_value.cc",
...
...
third_party/blink/renderer/bindings/core/v8/Loader.cc
0 → 100644
View file @
e6ffeef8
#include "nativeBox.h"
#include <dlfcn.h>
#include "third_party/blink/renderer/bindings/extensions/loadablemodule/src/Loadable.h"
#include "v8/include/v8.h"
using
v8
::
Local
;
using
v8
::
Value
;
using
v8
::
String
;
static
void
LoadeModule
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>
&
args
)
{
if
(
args
.
Length
()
<
1
)
return
;
v8
::
Isolate
*
isolate
=
args
.
GetIsolate
();
v8
::
HandleScope
scope
(
isolate
);
Local
<
Value
>
arg
=
args
[
0
];
String
::
Utf8Value
moduleName
(
isolate
,
arg
);
void
*
symbols
=
dlopen
(
"liblms.so"
,
RTLD_LAZY
);
if
(
!
symbols
)
{
std
::
cout
<<
"No Module found"
<<
std
::
endl
;
return
;
}
Loadable
::
LoadableModule
*
(
*
load
)(
std
::
string
);
load
=
(
Loadable
::
LoadableModule
*
(
*
)(
std
::
string
))
dlsym
(
symbols
,
"load"
);
Loadable
::
LoadableModule
*
module
=
load
(
"MP4Encoder"
);
NativeBox
box
{
module
};
args
.
GetReturnValue
().
Set
(
box
.
ToObject
(
isolate
));
}
static
void
Apply
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>
&
args
)
{
}
static
void
Done
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>
&
args
)
{
}
third_party/blink/renderer/bindings/core/v8/loader.h
0 → 100644
View file @
e6ffeef8
#include "v8/include/v8.h"
#ifndef LOADER_H
#define LOADER_H
static
void
LoadeModule
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>
&
args
);
static
void
Apply
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>
&
args
);
static
void
Done
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>
&
args
);
#endif
/* LOADER_H */
third_party/blink/renderer/bindings/core/v8/nativeBox.cc
View file @
e6ffeef8
...
...
@@ -23,6 +23,8 @@ using v8::Local;
// Anonymous which contains all transform functions
namespace
{
vector
<>
typedef
void
(
*
V8_Builtin
)(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>&
args
);
V8_Builtin
wrapWithTransformLayer
(
Loadable
::
Callback
callback
,
...
...
third_party/blink/renderer/bindings/core/v8/v8_initializer_custom.cc
View file @
e6ffeef8
#include <string>
#include <iostream>
#include "nativeBox.h"
#include "v8/include/v8.h"
#include "v8/include/v8-template.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-object.h"
#include "v8/include/v8-primitive.h"
#include "loader.h"
#include "third_party/blink/renderer/bindings/extensions/loadablemodule/src/Loadable.h"
#include <dlfcn.h>
using
v8
::
Local
;
using
v8
::
ObjectTemplate
;
...
...
@@ -20,32 +17,6 @@ using v8::Value;
using
v8
::
Maybe
;
using
v8
::
String
;
static
void
LoadeModule
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>&
args
)
{
if
(
args
.
Length
()
<
1
)
return
;;
v8
::
Isolate
*
isolate
=
args
.
GetIsolate
();
v8
::
HandleScope
scope
(
isolate
);
Local
<
Value
>
arg
=
args
[
0
];
String
::
Utf8Value
moduleName
(
isolate
,
arg
);
void
*
symbols
=
dlopen
(
"liblms.so"
,
RTLD_LAZY
);
if
(
!
symbols
)
{
std
::
cout
<<
"No Module found"
<<
std
::
endl
;
return
;
}
Loadable
::
LoadableModule
*
(
*
load
)(
std
::
string
);
load
=
(
Loadable
::
LoadableModule
*
(
*
)(
std
::
string
))
dlsym
(
symbols
,
"load"
);
Loadable
::
LoadableModule
*
module
=
load
(
"MP4Encoder"
);
NativeBox
box
{
module
};
args
.
GetReturnValue
().
Set
(
box
.
ToObject
(
isolate
));
}
void
PostInitializeV8
(
v8
::
Isolate
*
isolate
)
{
Local
<
Context
>
context
=
isolate
->
GetCurrentContext
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment