2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "runtime/browser/preload_manager.h"
19 #include <Elementary.h>
21 #include <EWebKit_internal.h>
24 #include "common/platform_info.h"
25 #include "common/logger.h"
26 #include "runtime/browser/native_app_window.h"
27 #include "extensions/common/xwalk_extension_server.h"
29 #ifndef INJECTED_BUNDLE_PATH
30 #error INJECTED_BUNDLE_PATH is not set.
35 PreloadManager* PreloadManager::GetInstance() {
36 static PreloadManager instance;
40 PreloadManager::PreloadManager() {
43 void PreloadManager::CreateCacheComponet() {
44 // Load extensions in the preload step
45 auto extension_server = extensions::XWalkExtensionServer::GetInstance();
46 extension_server->Preload();
48 // It was not used. just to fork zygote process
50 ewk_context_new_with_injected_bundle_path(INJECTED_BUNDLE_PATH);
51 context = context; // To prevent build warning
52 cached_window_.reset(new NativeAppWindow());
53 if (!TIZEN_FEATURE_display_resize_support)
54 cached_window_->Initialize();
57 NativeWindow* PreloadManager::GetCachedNativeWindow() {
58 return cached_window_ ? cached_window_.release() : nullptr;
61 void PreloadManager::ReleaseCachedNativeWindow() {
62 cached_window_.reset(nullptr);
65 } // namespace runtime