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
d44ef863
Commit
d44ef863
authored
Jan 11, 2018
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
2f42dc2c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
112 additions
and
6 deletions
+112
-6
Common/3dParty/v8/build.bat
Common/3dParty/v8/build.bat
+7
-5
Common/3dParty/v8/v8.pri
Common/3dParty/v8/v8.pri
+1
-1
DesktopEditor/doctrenderer/nativecontrol.h
DesktopEditor/doctrenderer/nativecontrol.h
+104
-0
No files found.
Common/3dParty/v8/build.bat
View file @
d44ef863
...
@@ -5,11 +5,13 @@ SET PATH=%SCRIPTPATH%depot_tools;%PATH%
...
@@ -5,11 +5,13 @@ SET PATH=%SCRIPTPATH%depot_tools;%PATH%
SET
DEPOT_TOOLS_WIN_TOOLCHAIN
=
0
SET
DEPOT_TOOLS_WIN_TOOLCHAIN
=
0
SET
GYP_MSVS_VERSION
=
2015
SET
GYP_MSVS_VERSION
=
2015
cd
v8
call
gn
gen
out
.gn/win_64
-
-args
=
"is_debug=false target_cpu=\"
x64
\
" v8_target_cpu=\"
x64
\
" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
cd
../
call
powershell
-File
.\fix
-static
_crt.ps1
call
powershell
-File
.\fix
-static
_crt.ps1
cd
v8
cd
v8
call
ninja
-C
out
.gn/win_64
call
gn
gen
out
.gn/win_64/release
-
-args
=
"is_debug=false target_cpu=\"
x64
\
" v8_target_cpu=\"
x64
\
" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
\ No newline at end of file
call
ninja
-C
out
.gn/win_64/release
call
gn
gen
out
.gn/win_64/debug
-
-args
=
"is_debug=true target_cpu=\"
x64
\
" v8_target_cpu=\"
x64
\
" v8_static_library=true is_component_build=false v8_use_snapshot=false is_clang=false"
call
ninja
-C
out
.gn/win_64/debug
rem v8_use_snapshot=true v8_use_external_startup_data=true
\ No newline at end of file
Common/3dParty/v8/v8.pri
View file @
d44ef863
...
@@ -6,7 +6,7 @@ INCLUDEPATH += \
...
@@ -6,7 +6,7 @@ INCLUDEPATH += \
$$CORE_V8_PATH_INCLUDE/include
$$CORE_V8_PATH_INCLUDE/include
core_windows {
core_windows {
#CORE_V8_PATH_LIBS = $$CORE_V8_PATH_INCLUDE/out.gn/$$CORE_BUILDS_PLATFORM_PREFIX_
$$CORE_BUILDS_CONFIGURATION_PREFIX/obj
CORE_V8_PATH_LIBS = $$CORE_V8_PATH_INCLUDE/out.gn/$$CORE_BUILDS_PLATFORM_PREFIX/
$$CORE_BUILDS_CONFIGURATION_PREFIX/obj
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_snapshot -lv8_libsampler
LIBS += -L$$CORE_V8_PATH_LIBS -lv8_base -lv8_libplatform -lv8_libbase -lv8_snapshot -lv8_libsampler
LIBS += -L$$CORE_V8_PATH_LIBS/third_party/icu -licui18n -licuuc
LIBS += -L$$CORE_V8_PATH_LIBS/third_party/icu -licui18n -licuuc
...
...
DesktopEditor/doctrenderer/nativecontrol.h
View file @
d44ef863
...
@@ -1036,6 +1036,110 @@ public:
...
@@ -1036,6 +1036,110 @@ public:
#define LOGGER_SPEED_LAP(__logger_param)
#define LOGGER_SPEED_LAP(__logger_param)
#endif
#endif
//////////////////////////////////////////////////////////////////////////////
#if 0
class CSnapshotScript
{
public:
bool m_bIsExist;
v8::StartupData m_oStartupData;
CSnapshotScript(const std::wstring& sDir = L"")
{
m_bIsExist = false;
m_oStartupData.data = NULL;
m_oStartupData.raw_size = 0;
std::wstring sFile = sDir + L"/heap_snapshot.bin";
if (NSFile::CFileBinary::Exists(sFile))
{
m_bIsExist = true;
NSFile::CFileBinary oFile;
oFile.OpenFile(sFile);
m_oStartupData.raw_size = (int)oFile.GetFileSize();
m_oStartupData.data = new char[m_oStartupData.raw_size];
DWORD dwRead = 0;
oFile.ReadFile((BYTE*)m_oStartupData.data, (DWORD)m_oStartupData.raw_size, dwRead);
oFile.CloseFile();
}
}
bool Generate(const std::string& sScript)
{
m_oStartupData = {NULL, 0};
{
v8::SnapshotCreator snapshot_creator;
// Obtain an isolate provided by SnapshotCreator.
v8::Isolate* isolate = snapshot_creator.GetIsolate();
{
v8::HandleScope scope(isolate);
// Create a new context and optionally run some script.
v8::Local<v8::Context> context = v8::Context::New(isolate);
//v8::Context::Scope context_scope(context);
if (!RunExtraCode(isolate, context, sScript.c_str(), "<embedded>"))
return false;
// Add the possibly customized context to the SnapshotCreator.
snapshot_creator.SetDefaultContext(context);
}
// Use the SnapshotCreator to create the snapshot blob.
m_oStartupData = snapshot_creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
}
return true;
}
void Save(const std::wstring& sDir)
{
if (m_oStartupData.data == NULL)
return;
std::wstring sFile = sDir + L"/heap_snapshot.bin";
NSFile::CFileBinary oFile;
oFile.CreateFile(sFile);
oFile.WriteFile((BYTE*)m_oStartupData.data, (DWORD)m_oStartupData.raw_size);
oFile.CloseFile();
}
bool RunExtraCode(v8::Isolate* isolate, v8::Local<v8::Context> context, const char* utf8_source, const char* name)
{
// Run custom script if provided.
v8::TryCatch try_catch(isolate);
v8::Local<v8::String> source_string;
if (!v8::String::NewFromUtf8(isolate, utf8_source, v8::NewStringType::kNormal).ToLocal(&source_string))
return false;
v8::Local<v8::String> resource_name = v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kNormal).ToLocalChecked();
v8::ScriptOrigin origin(resource_name);
v8::ScriptCompiler::Source source(source_string, origin);
v8::Local<v8::Script> script;
bool bRet = v8::ScriptCompiler::Compile(context, &source).ToLocal(&script);
if (try_catch.HasCaught())
{
std::string strCode = to_cstringA(try_catch.Message()->GetSourceLine());
std::string strException = to_cstringA(try_catch.Message()->Get());
return false;
}
script->Run();
if (try_catch.HasCaught())
{
std::string strCode = to_cstringA(try_catch.Message()->GetSourceLine());
std::string strException = to_cstringA(try_catch.Message()->Get());
return false;
}
return true;
}
};
#endif
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
class
CV8Initializer
class
CV8Initializer
{
{
...
...
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