}
#endif
+bool g_prelaunch_ = false;
+std::unique_ptr<AtomContentClient> g_atom_content_client_;
+std::unique_ptr<AtomBrowserClient> g_atom_browser_client_;
+
} // namespace
+
AtomMainDelegate::AtomMainDelegate() {
}
}
content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
- browser_client_.reset(new AtomBrowserClient);
+ if (!g_prelaunch_)
+ browser_client_.reset(new AtomBrowserClient);
+ else browser_client_.reset(g_atom_browser_client_.release());
return browser_client_.get();
}
std::unique_ptr<brightray::ContentClient>
AtomMainDelegate::CreateContentClient() {
- return std::unique_ptr<brightray::ContentClient>(new AtomContentClient);
+ if (!g_prelaunch_)
+ return std::unique_ptr<brightray::ContentClient>(new AtomContentClient);
+ else return std::unique_ptr<brightray::ContentClient>(g_atom_content_client_.release());
+}
+
+// static
+void AtomMainDelegate::Preload() {
+ g_atom_content_client_.reset(new AtomContentClient);
+ g_atom_browser_client_.reset(new AtomBrowserClient);
+ g_prelaunch_ = true;
}
} // namespace atom
AtomMainDelegate();
~AtomMainDelegate();
+ static void Preload();
+
protected:
// content::ContentMainDelegate:
bool BasicStartupComplete(int* exit_code) override;
UiRuntime::UiRuntime(content::ContentMainParams *params) {
_params = params;
+ // This line's position is essential as this creates the Browser
+ // object which is needed later on by ui_runtime in its ui_loop callbacks
atom::AtomBrowserMainParts::SetNodeEnvironment();
}
container->erase(iter);
}
-} // namespace
-
-// static
+// static - lines have been moved to limit their visibility only to this file
bool g_prelaunch = false;
-AtomBrowserMainParts* AtomBrowserMainParts::self_ = nullptr;
node::Environment* env_ = nullptr;
scoped_refptr<BridgeTaskRunner> self_bridge_task_runner;
std::unique_ptr<Browser> self_browser;
std::unique_ptr<NodeEnvironment> self_node_env;
std::unique_ptr<NodeDebugger> self_node_debugger;
+} // namespace
+
+AtomBrowserMainParts* AtomBrowserMainParts::self_ = nullptr;
+
AtomBrowserMainParts::AtomBrowserMainParts()
: fake_browser_process_(new BrowserProcess),
exit_code_(nullptr),
'chromium_src/net/test/embedded_test_server/stream_listen_socket.h',
'chromium_src/net/test/embedded_test_server/tcp_listen_socket.cc',
'chromium_src/net/test/embedded_test_server/tcp_listen_socket.h',
+ 'tizen/browser/preload_manager.cc',
+ 'tizen/browser/preload_manager.h',
'<@(native_mate_files)',
'<(SHARED_INTERMEDIATE_DIR)/atom_natives.h',
'<(SHARED_INTERMEDIATE_DIR)/grit/pdf_viewer_resources_map.cc',
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "tizen/browser/preload_manager.h"
+
+#include "atom/app/atom_main_delegate.h"
+#include "extensions/common/xwalk_extension_server.h"
+
+namespace tizen {
+
+PreloadManager* PreloadManager::GetInstance() {
+ static PreloadManager instance;
+ return &instance;
+}
+
+PreloadManager::PreloadManager() {
+}
+
+void PreloadManager::CreateCacheComponent() {
+ // Load extensions in the preload step
+ auto extension_server = extensions::XWalkExtensionServer::GetInstance();
+ extension_server->Preload();
+
+ atom::AtomMainDelegate::Preload();
+}
+
+} // namespace tizen
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TIZEN_BROWSER_PRELOAD_MANAGER_H_
+#define TIZEN_BROWSER_PRELOAD_MANAGER_H_
+
+#include <memory>
+
+
+namespace tizen {
+class PreloadManager {
+ public:
+ static PreloadManager* GetInstance();
+ void CreateCacheComponent();
+
+ private:
+ PreloadManager();
+};
+
+} // namespace tizen
+
+#endif // TIZEN_BROWSER_PRELOAD_MANAGER_H_
#include "tizen/common/application_data.h"
#include "tizen/common/command_line.h"
#include "tizen/loader/prelauncher.h"
+#include "tizen/browser/preload_manager.h"
#endif
namespace {
params.argv = const_cast<const char**>(argv);
atom::AtomCommandLine::Init(argc, argv);
runtime_ = runtime::Runtime::MakeRuntime(nullptr);
+ tizen::PreloadManager::GetInstance()->CreateCacheComponent();
return 0;
};
auto did_launch = [](const std::string& app_path) {