Skip to content

Commit 685f33c

Browse files
committed
nwjs master
1 parent 53b2efc commit 685f33c

File tree

636 files changed

+8695
-1733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

636 files changed

+8695
-1733
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,3 +500,5 @@ vs-chromium-project.txt
500500
/win8/metro_driver/metro_driver_version_resources.xml
501501
/x86-generic_out/
502502
/xcodebuild
503+
/content/nw
504+

.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ check_targets = [
206206
# this situation much easier to create. if the build always lists the
207207
# files and passes them to a script, it will always be correct.
208208
exec_script_whitelist = [
209+
"//content/nw/BUILD.gn",
209210
"//android_webview/BUILD.gn",
210211
"//ash/BUILD.gn",
211212
"//build/config/BUILD.gn",

BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ group("both_gn_and_gyp") {
203203

204204
if (!is_ios && !is_android && !is_chromecast) {
205205
deps += [
206+
"//content/nw:nwjs",
206207
"//chrome",
207208
"//chrome/test:browser_tests",
208209
"//chrome/test:interactive_ui_tests",

DEPS

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ vars = {
1313
'https://chromium.googlesource.com',
1414
'freetype_android_revision':
1515
'c38be52bf8de3b1699d74932b849bf150265819e',
16+
'nwjs_git':
17+
'https://github.com/nwjs',
1618
'google_toolbox_for_mac_revision':
1719
'e7b41fad2e7f77abf560c79f984c60d5ec6d419c',
1820
'libfuzzer_revision':
@@ -168,8 +170,13 @@ deps = {
168170
(Var("chromium_git")) + '/chromium/deps/acid3.git@6be0a66a1ebd7ebc5abc1b2f405a945f6d871521',
169171
'src/tools/swarming_client':
170172
(Var("chromium_git")) + '/external/swarming.client.git@e4288c3040a32f2e7ad92f957668f2ee3d36e5a6',
171-
'src/v8':
172-
(Var("chromium_git")) + '/v8/v8.git@f8cbe2768cc88cb40e24c929fb28965bfb0ca6fe'
173+
#'src/v8':
174+
# (Var("chromium_git")) + '/v8/v8.git@f8cbe2768cc88cb40e24c929fb28965bfb0ca6fe'
175+
# (Var("nwjs_git")) + '/v8.git@origin/nw16',
176+
#'src/content/nw':
177+
# (Var("nwjs_git")) + '/nw.js.git@origin/nw16',
178+
#'src/third_party/node':
179+
# (Var("nwjs_git")) + '/node.git@origin/nw16',
173180
}
174181

175182
deps_os = {
@@ -952,7 +959,18 @@ hooks = [
952959
'.',
953960
'name':
954961
'doclava'
955-
}
962+
},
963+
{
964+
'action': [
965+
'python',
966+
'src/content/nw/tools/patcher.py',
967+
'--patch-config', 'src/content/nw/patch/patch.cfg'
968+
],
969+
'pattern':
970+
'.',
971+
'name':
972+
'nw_patch'
973+
},
956974
]
957975

958976
include_rules = [

apps/app_lifetime_monitor.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ void AppLifetimeMonitor::OnAppWindowRemoved(AppWindow* app_window) {
8686
}
8787

8888
void AppLifetimeMonitor::OnAppWindowHidden(AppWindow* app_window) {
89+
#if 0
8990
if (!HasOtherVisibleAppWindows(app_window))
9091
NotifyAppDeactivated(app_window->extension_id());
92+
#endif
9193
}
9294

9395
void AppLifetimeMonitor::OnAppWindowShown(AppWindow* app_window,

apps/app_load_service.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "apps/app_load_service.h"
66

7+
#include "content/nw/src/nw_content.h"
8+
79
#include "apps/app_load_service_factory.h"
810
#include "apps/app_restore_service.h"
911
#include "apps/launcher.h"
@@ -70,6 +72,8 @@ bool AppLoadService::LoadAndLaunch(const base::FilePath& extension_path,
7072
return false;
7173
}
7274

75+
nw::SetMainExtensionId(extension_id);
76+
7377
// Schedule the app to be launched once loaded.
7478
PostReloadAction& action = post_reload_actions_[extension_id];
7579
action.action_type = LAUNCH_FOR_LOAD_AND_LAUNCH;

apps/launcher.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ class PlatformAppPathLauncher
103103
extension_id(app->id()),
104104
entry_paths_(entry_paths),
105105
mime_type_collector_(profile),
106-
is_directory_collector_(profile) {}
106+
is_directory_collector_(profile) {
107+
if (app->is_nwjs_app()) //NWJS#5097
108+
entry_paths_.clear();
109+
}
107110

108111
PlatformAppPathLauncher(Profile* profile,
109112
const Extension* app,
@@ -112,7 +115,7 @@ class PlatformAppPathLauncher
112115
extension_id(app->id()),
113116
mime_type_collector_(profile),
114117
is_directory_collector_(profile) {
115-
if (!file_path.empty())
118+
if (!file_path.empty() && !app->is_nwjs_app()) //NWJS#5097
116119
entry_paths_.push_back(file_path);
117120
}
118121

base/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ component("base") {
518518
"message_loop/message_pump_libevent.h",
519519
"message_loop/message_pump_mac.h",
520520
"message_loop/message_pump_mac.mm",
521+
"message_loop/message_pump_uv.cc",
522+
"message_loop/message_pump_uv.h",
521523
"message_loop/message_pump_win.cc",
522524
"message_loop/message_pump_win.h",
523525
"metrics/bucket_ranges.cc",

base/base.gyp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@
251251
'message_loop/message_pump_libevent.h',
252252
'message_loop/message_pump_mac.h',
253253
'message_loop/message_pump_mac.mm',
254+
'message_loop/message_pump_uv.cc',
255+
'message_loop/message_pump_uv.h',
254256
'metrics/field_trial.cc',
255257
'metrics/field_trial.h',
256258
'posix/file_descriptor_shuffle.cc',

base/base_switches.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,5 @@ const char kEnableCrashReporterForTesting[] =
111111
"enable-crash-reporter-for-testing";
112112
#endif
113113

114+
const char kNWJS[] = "nwjs";
114115
} // namespace switches

base/base_switches.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ extern const char kDisableUsbKeyboardDetect[];
3939
extern const char kEnableCrashReporterForTesting[];
4040
#endif
4141

42+
extern const char kNWJS[];
4243
} // namespace switches
4344

4445
#endif // BASE_BASE_SWITCHES_H_

base/command_line.cc

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,43 +151,83 @@ string16 QuoteForCommandLineToArgvW(const string16& arg,
151151

152152
CommandLine::CommandLine(NoProgram no_program)
153153
: argv_(1),
154-
begin_args_(1) {
154+
begin_args_(1),
155+
argc0_(0), argv0_(NULL) {
155156
}
156157

157158
CommandLine::CommandLine(const FilePath& program)
158159
: argv_(1),
159-
begin_args_(1) {
160+
begin_args_(1),
161+
argc0_(0), argv0_(NULL) {
160162
SetProgram(program);
161163
}
162164

163165
CommandLine::CommandLine(int argc, const CommandLine::CharType* const* argv)
164166
: argv_(1),
165-
begin_args_(1) {
167+
begin_args_(1),
168+
argc0_(0), argv0_(NULL) {
166169
InitFromArgv(argc, argv);
167170
}
168171

169172
CommandLine::CommandLine(const StringVector& argv)
170173
: argv_(1),
171-
begin_args_(1) {
174+
begin_args_(1),
175+
argc0_(0), argv0_(NULL) {
172176
InitFromArgv(argv);
173177
}
174178

175179
CommandLine::CommandLine(const CommandLine& other)
176180
: argv_(other.argv_),
181+
original_argv_(other.original_argv_),
177182
switches_(other.switches_),
178-
begin_args_(other.begin_args_) {
183+
begin_args_(other.begin_args_),
184+
argc0_(other.argc0_), argv0_(NULL) {
185+
186+
#if defined(OS_WIN)
187+
if (other.argv0_) {
188+
argv0_ = new char*[argc0_ + 1];
189+
for (int i = 0; i < argc0_; ++i) {
190+
argv0_[i] = new char[strlen(other.argv0_[i]) + 1];
191+
strcpy(argv0_[i], other.argv0_[i]);
192+
}
193+
argv0_[argc0_] = NULL;
194+
}
195+
#else
196+
argv0_ = other.argv0_;
197+
#endif
179198
ResetStringPieces();
180199
}
181200

182201
CommandLine& CommandLine::operator=(const CommandLine& other) {
183202
argv_ = other.argv_;
203+
original_argv_ = other.original_argv_;
184204
switches_ = other.switches_;
185205
begin_args_ = other.begin_args_;
206+
#if defined(OS_WIN)
207+
if (other.argv0_) {
208+
argv0_ = new char*[argc0_ + 1];
209+
for (int i = 0; i < argc0_; ++i) {
210+
argv0_[i] = new char[strlen(other.argv0_[i]) + 1];
211+
strcpy(argv0_[i], other.argv0_[i]);
212+
}
213+
argv0_[argc0_] = NULL;
214+
}
215+
#else
216+
argv0_ = other.argv0_;
217+
#endif
186218
ResetStringPieces();
187219
return *this;
188220
}
189221

190222
CommandLine::~CommandLine() {
223+
#if defined(OS_WIN)
224+
if (!argv0_)
225+
return;
226+
for (int i = 0; i < argc0_; i++) {
227+
delete[] argv0_[i];
228+
}
229+
delete[] argv0_;
230+
#endif
191231
}
192232

193233
#if defined(OS_WIN)
@@ -259,12 +299,34 @@ CommandLine CommandLine::FromString(const string16& command_line) {
259299
void CommandLine::InitFromArgv(int argc,
260300
const CommandLine::CharType* const* argv) {
261301
StringVector new_argv;
302+
argc0_ = argc;
303+
#if !defined(OS_WIN)
304+
argv0_ = (char**)argv;
305+
#else
306+
argv0_ = new char*[argc + 1];
307+
for (int i = 0; i < argc; ++i) {
308+
std::string str(base::WideToUTF8(argv[i]));
309+
argv0_[i] = new char[str.length() + 1];
310+
strcpy(argv0_[i], str.c_str());
311+
}
312+
argv0_[argc] = NULL;
313+
#endif
262314
for (int i = 0; i < argc; ++i)
263315
new_argv.push_back(argv[i]);
264316
InitFromArgv(new_argv);
265317
}
266318

267319
void CommandLine::InitFromArgv(const StringVector& argv) {
320+
#if !defined(OS_MACOSX)
321+
original_argv_ = argv;
322+
#else
323+
for (size_t index = 0; index < argv.size(); ++index) {
324+
if (argv[index].compare(0, strlen("--psn_"), "--psn_") != 0 &&
325+
argv[index].compare(0, strlen("-psn_"), "-psn_") != 0) {
326+
original_argv_.push_back(argv[index]);
327+
}
328+
}
329+
#endif
268330
argv_ = StringVector(1);
269331
switches_.clear();
270332
switches_by_stringpiece_.clear();
@@ -401,6 +463,12 @@ void CommandLine::AppendArgNative(const CommandLine::StringType& value) {
401463
argv_.push_back(value);
402464
}
403465

466+
#if defined(OS_MACOSX)
467+
void CommandLine::FixOrigArgv4Finder(const CommandLine::StringType& value) {
468+
original_argv_.push_back(value);
469+
}
470+
#endif
471+
404472
void CommandLine::AppendArguments(const CommandLine& other,
405473
bool include_program) {
406474
if (include_program)

base/command_line.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ class BASE_EXPORT CommandLine {
150150

151151
// Returns the original command line string as a vector of strings.
152152
const StringVector& argv() const { return argv_; }
153+
int argc0() { return argc0_; }
154+
char** argv0() { return argv0_; }
155+
156+
// Returns the original command line string as a vector of strings (keeps precedence).
157+
const StringVector& original_argv() const { return original_argv_; }
153158

154159
// Get and Set the program part of the command line string (the first item).
155160
FilePath GetProgram() const;
@@ -200,6 +205,10 @@ class BASE_EXPORT CommandLine {
200205
void AppendArgPath(const FilePath& value);
201206
void AppendArgNative(const StringType& value);
202207

208+
#if defined(OS_MACOSX)
209+
void FixOrigArgv4Finder(const StringType& value);
210+
#endif
211+
203212
// Append the switches and arguments from another command line to this one.
204213
// If |include_program| is true, include |other|'s program as well.
205214
void AppendArguments(const CommandLine& other, bool include_program);
@@ -241,6 +250,9 @@ class BASE_EXPORT CommandLine {
241250
// The argv array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* }
242251
StringVector argv_;
243252

253+
// The argv array (precedence not messed).
254+
StringVector original_argv_;
255+
244256
// Parsed-out switch keys and values.
245257
SwitchMap switches_;
246258

@@ -252,6 +264,9 @@ class BASE_EXPORT CommandLine {
252264

253265
// The index after the program and switches, any arguments start here.
254266
size_t begin_args_;
267+
268+
int argc0_;
269+
char** argv0_;
255270
};
256271

257272
} // namespace base

base/files/file_util_posix.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ std::string TempFileName() {
139139
#if defined(GOOGLE_CHROME_BUILD)
140140
return std::string(".com.google.Chrome.XXXXXX");
141141
#else
142-
return std::string(".org.chromium.Chromium.XXXXXX");
142+
return std::string(".io.nwjs.XXXXXX");
143143
#endif
144144
}
145145

base/message_loop/message_loop.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ std::unique_ptr<MessagePump> MessageLoop::CreateMessagePumpForType(Type type) {
250250
return std::unique_ptr<MessagePump>(new MessagePumpForUI());
251251
#endif
252252

253+
if (type == MessageLoop::TYPE_NODE)
254+
return std::unique_ptr<MessagePump>(new MessagePumpUV());
255+
253256
DCHECK_EQ(MessageLoop::TYPE_DEFAULT, type);
254257
return MESSAGE_PUMP_DEFAULT;
255258
}

0 commit comments

Comments
 (0)