Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
6a1cf1e4
Commit
6a1cf1e4
authored
Mar 31, 2016
by
Oleg Korshul
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
поддержка новой версии v8
и возможность несколько раз запускать doctrenderer/docbuilder
parent
107e460d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
67 deletions
+96
-67
DesktopEditor/doctrenderer/docbuilder.cpp
DesktopEditor/doctrenderer/docbuilder.cpp
+3
-39
DesktopEditor/doctrenderer/doctrenderer.cpp
DesktopEditor/doctrenderer/doctrenderer.cpp
+3
-20
DesktopEditor/doctrenderer/doctrenderer.pro
DesktopEditor/doctrenderer/doctrenderer.pro
+7
-3
DesktopEditor/doctrenderer/linux environment setup.txt
DesktopEditor/doctrenderer/linux environment setup.txt
+4
-1
DesktopEditor/doctrenderer/nativecontrol.cpp
DesktopEditor/doctrenderer/nativecontrol.cpp
+20
-2
DesktopEditor/doctrenderer/nativecontrol.h
DesktopEditor/doctrenderer/nativecontrol.h
+59
-2
No files found.
DesktopEditor/doctrenderer/docbuilder.cpp
View file @
6a1cf1e4
#
include
"docbuilder.h"
//#include "nativecontrol.h"
#include "../xml/include/xmlutils.h"
#include <iostream>
...
...
@@ -37,30 +36,6 @@ public:
CScopeWrapper
(
v8
::
Isolate
*
isolate
)
:
m_handler
(
isolate
)
{}
};
class
CV8Initializer
{
private:
v8
::
Platform
*
m_platform
;
public:
CV8Initializer
()
{
m_platform
=
v8
::
platform
::
CreateDefaultPlatform
();
v8
::
V8
::
InitializePlatform
(
m_platform
);
v8
::
V8
::
Initialize
();
v8
::
V8
::
InitializeICU
();
enableTypedArrays
();
}
~
CV8Initializer
()
{
v8
::
V8
::
Dispose
();
v8
::
V8
::
ShutdownPlatform
();
delete
m_platform
;
}
};
class
CV8RealTimeWorker
{
public:
...
...
@@ -74,19 +49,13 @@ public:
int
m_nFileType
;
public:
static
CV8Initializer
*
m_pInitializer
;
public:
CV8RealTimeWorker
()
{
if
(
NULL
==
m_pInitializer
)
NSDoctRenderer
::
CDocBuilder
::
Initialize
();
m_nFileType
=
-
1
;
m_isolate
=
v8
::
Isolate
::
New
();
m_isolate
=
CV8Worker
::
getInitializer
()
->
Create
New
();
m_isolate_scope
=
new
v8
::
Isolate
::
Scope
(
m_isolate
);
m_isolate_locker
=
new
v8
::
Locker
(
m_isolate
);
...
...
@@ -296,8 +265,6 @@ public:
}
};
CV8Initializer
*
CV8RealTimeWorker
::
m_pInitializer
=
NULL
;
#ifdef CreateFile
#undef CreateFile
#endif
...
...
@@ -1189,14 +1156,11 @@ namespace NSDoctRenderer
void
CDocBuilder
::
Initialize
()
{
if
(
NULL
==
CV8RealTimeWorker
::
m_pInitializer
)
CV8RealTimeWorker
::
m_pInitializer
=
new
CV8Initializer
();
CV8Worker
::
Initialize
();
}
void
CDocBuilder
::
Dispose
()
{
if
(
NULL
!=
CV8RealTimeWorker
::
m_pInitializer
)
delete
CV8RealTimeWorker
::
m_pInitializer
;
CV8RealTimeWorker
::
m_pInitializer
=
NULL
;
CV8Worker
::
Dispose
();
}
}
DesktopEditor/doctrenderer/doctrenderer.cpp
View file @
6a1cf1e4
#
include
"doctrenderer.h"
#include "docbuilder.h"
#ifdef BOOL
#undef BOOL
...
...
@@ -209,8 +210,6 @@ namespace NSDoctRenderer
std
::
wstring
m_strEditorType
;
std
::
wstring
m_strFilePath
;
bool
m_bIsInitTypedArrays
;
std
::
vector
<
std
::
wstring
>
m_arImagesInChanges
;
std
::
wstring
m_sConsoleLogFile
;
...
...
@@ -219,8 +218,6 @@ namespace NSDoctRenderer
public:
CDoctRenderer_Private
(
const
std
::
wstring
&
sAllFontsPath
=
L""
)
{
m_bIsInitTypedArrays
=
false
;
m_strConfigDir
=
NSFile
::
GetProcessDirectory
()
+
L"/"
;
m_strConfigPath
=
m_strConfigDir
+
L"DoctRenderer.config"
;
...
...
@@ -515,20 +512,8 @@ namespace NSDoctRenderer
bool
ExecuteScript
(
const
std
::
string
&
strScript
,
std
::
wstring
&
strError
,
std
::
wstring
&
strReturnParams
)
{
v8
::
Platform
*
platform
=
v8
::
platform
::
CreateDefaultPlatform
();
v8
::
V8
::
InitializePlatform
(
platform
);
v8
::
V8
::
Initialize
();
v8
::
V8
::
InitializeICU
();
if
(
!
m_bIsInitTypedArrays
)
{
enableTypedArrays
();
m_bIsInitTypedArrays
=
true
;
}
bool
bIsBreak
=
false
;
v8
::
Isolate
*
isolate
=
v8
::
Isolate
::
New
();
v8
::
Isolate
*
isolate
=
CV8Worker
::
getInitializer
()
->
Create
New
();
if
(
true
)
{
v8
::
Isolate
::
Scope
isolate_cope
(
isolate
);
...
...
@@ -909,10 +894,8 @@ namespace NSDoctRenderer
}
isolate
->
Dispose
();
v8
::
V8
::
Dispose
();
v8
::
V8
::
ShutdownPlatform
();
delete
platform
;
CV8Worker
::
Dispose
();
return
bIsBreak
?
false
:
true
;
}
...
...
DesktopEditor/doctrenderer/doctrenderer.pro
View file @
6a1cf1e4
...
...
@@ -17,7 +17,7 @@ CONFIG += plugin
CONFIG
+=
c
++
11
###############
destination
path
###############
DESTINATION_SDK_PATH
=
$$
PWD
/../../
SDK
/
lib
DESTINATION_SDK_PATH
=
$$
PWD
/../../
build
/
lib
#
WINDOWS
win32
:
contains
(
QMAKE_TARGET
.
arch
,
x86_64
)
:
{
...
...
@@ -66,7 +66,10 @@ linux-g++ | linux-g++-64 | linux-g++-32 {
}
mac
{
V8_CHECKOUT_PATH
=
/
Users
/
Oleg
/
Desktop
/
activex
/
v8
DEFINES
+=
NEW_V8_ENGINE
#
V8_CHECKOUT_PATH
=
/
Users
/
Oleg
/
Desktop
/
GIT
/
v8_mac_work
/
v8
V8_CHECKOUT_PATH
=
/
Users
/
Oleg
/
Desktop
/
GIT
/
v8_mac
/
v8
}
win32
{
...
...
@@ -164,7 +167,8 @@ mac {
MAC
\
QT_MAC
LIBS
+=
-
L
$$
V8_CHECKOUT_PATH
/
out
/
native
-
lv8_base
-
lv8_libbase
-
lv8_libplatform
-
lv8_nosnapshot
-
lv8_snapshot
#
LIBS
+=
-
L
$$
V8_CHECKOUT_PATH
/
out
/
native
-
lv8_base
-
lv8_libbase
-
lv8_libplatform
-
lv8_nosnapshot
-
lv8_snapshot
LIBS
+=
-
L
$$
V8_CHECKOUT_PATH
/
out
/
native
-
lv8_base
-
lv8_libbase
-
lv8_libplatform
-
lv8_nosnapshot
-
lv8_external_snapshot
LIBS
+=
-
L
$$
V8_CHECKOUT_PATH
/
out
/
native
-
licui18n
-
licuuc
-
licudata
message
(
mac
)
...
...
DesktopEditor/doctrenderer/linux environment setup.txt
View file @
6a1cf1e4
...
...
@@ -27,7 +27,10 @@ gclient
fetch v8
cd v8
// make native
CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native
CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native
#mac:
CFLAGS="-fPIC" CXXFLAGS="-fPIC -stdlib=libc++" LDFLAGS="-stdlib=libc++" make native
# or ---------------------------------------------------------------------------------------------------
sudo apt-get install git
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
...
...
DesktopEditor/doctrenderer/nativecontrol.cpp
View file @
6a1cf1e4
...
...
@@ -374,7 +374,25 @@ v8::Handle<v8::ObjectTemplate> CreateNativeControlTemplateBuilder(v8::Isolate* i
}
// --------------------------
void
enableTypedArrays
()
void
CV8Worker
::
Initialize
()
{
v8
::
V8
::
SetArrayBufferAllocator
(
new
MallocArrayBufferAllocator
());
if
(
NULL
==
CV8Worker
::
m_pInitializer
)
CV8Worker
::
m_pInitializer
=
new
CV8Initializer
();
}
void
CV8Worker
::
Dispose
()
{
if
(
NULL
!=
CV8Worker
::
m_pInitializer
)
delete
CV8Worker
::
m_pInitializer
;
CV8Worker
::
m_pInitializer
=
NULL
;
}
CV8Initializer
*
CV8Worker
::
getInitializer
()
{
if
(
NULL
==
CV8Worker
::
m_pInitializer
)
CV8Worker
::
m_pInitializer
=
new
CV8Initializer
();
return
CV8Worker
::
m_pInitializer
;
}
CV8Initializer
*
CV8Worker
::
m_pInitializer
=
NULL
;
// --------------------------
DesktopEditor/doctrenderer/nativecontrol.h
View file @
6a1cf1e4
...
...
@@ -318,8 +318,6 @@ public:
}
};
void
enableTypedArrays
();
class
CChangesWorker
{
private:
...
...
@@ -851,4 +849,63 @@ void CreateNativeObject(const v8::FunctionCallbackInfo<v8::Value>& args);
void
CreateNativeObjectBuilder
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>&
args
);
void
CreateNativeMemoryStream
(
const
v8
::
FunctionCallbackInfo
<
v8
::
Value
>&
args
);
//////////////////////////////////////////////////////////////////////////////
class
CV8Initializer
{
private:
v8
::
Platform
*
m_platform
;
MallocArrayBufferAllocator
m_oAllocator
;
public:
CV8Initializer
()
:
m_oAllocator
()
{
m_platform
=
v8
::
platform
::
CreateDefaultPlatform
();
v8
::
V8
::
InitializePlatform
(
m_platform
);
v8
::
V8
::
Initialize
();
v8
::
V8
::
InitializeICU
();
#ifndef NEW_V8_ENGINE
v8
::
V8
::
SetArrayBufferAllocator
(
&
m_oAllocator
);
#endif
}
~
CV8Initializer
()
{
v8
::
V8
::
Dispose
();
v8
::
V8
::
ShutdownPlatform
();
delete
m_platform
;
}
v8
::
ArrayBuffer
::
Allocator
*
getAllocator
()
{
return
&
m_oAllocator
;
}
v8
::
Isolate
*
CreateNew
()
{
#ifdef NEW_V8_ENGINE
v8
::
Isolate
::
CreateParams
create_params
;
create_params
.
array_buffer_allocator
=
&
m_oAllocator
;
return
v8
::
Isolate
::
New
(
create_params
);
#else
return
v8
::
Isolate
::
New
();
#endif
}
};
class
CV8Worker
{
private:
static
CV8Initializer
*
m_pInitializer
;
public:
CV8Worker
()
{}
~
CV8Worker
()
{}
static
void
Initialize
();
static
void
Dispose
();
static
CV8Initializer
*
getInitializer
();
};
#endif // NATIVECONTROL
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