Created IPC for Resume and Suspend operation to reach at Chromium level.
Change-Id: I2a38c77f225b102da14607b3a5dde787c78e697a
Signed-off-by: deepti <d.saraswat@samsung.com>
#include "base/threading/thread_task_runner_handle.h"
#include "brightray/browser/brightray_paths.h"
#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_view_host.h"
+
#if defined(OS_TIZEN)
#include "tizen/common/command_line.h"
#include "tizen/common/application_data.h"
#if defined(OS_TIZEN)
void Browser::Hide() {
NativeWindow *last_window = WindowList::GetLastWindow();
- if (last_window)
- last_window->NotifySuspend();
+ if (!last_window)
+ return;
+
+ last_window->NotifySuspend();
+ auto rvh = last_window->web_contents()->GetRenderViewHost();
+ atom::Browser::Get()->Suspend(rvh);
}
void Browser::Show() {
NativeWindow *last_window = WindowList::GetLastWindow();
- if (last_window)
- last_window->NotifyResume();
+ if (!last_window)
+ return;
+
+ last_window->NotifyResume();
+ auto rvh = last_window->web_contents()->GetRenderViewHost();
+ atom::Browser::Get()->Resume(rvh);
}
void Browser::AppControl(std::unique_ptr<common::AppControl> appcontrol) {
std::string)
IPC_MESSAGE_ROUTED1(WrtViewMsg_SetLongPolling,
- unsigned long)
\ No newline at end of file
+ unsigned long)
+
+IPC_MESSAGE_ROUTED0(WrtViewMsg_SuspendScheduledTask)
+IPC_MESSAGE_ROUTED0(WrtViewMsg_ResumeScheduledTasks)
+
+
IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
IPC_MESSAGE_HANDLER(AtomViewMsg_Message, OnBrowserMessage)
IPC_MESSAGE_HANDLER(WrtViewMsg_SetLongPolling, OnSetLongPolling)
+ IPC_MESSAGE_HANDLER(WrtViewMsg_SuspendScheduledTask, OnSuspendScheduledTasks)
+ IPC_MESSAGE_HANDLER(WrtViewMsg_ResumeScheduledTasks, OnResumeScheduledTasks)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
+void AtomRenderViewObserver::OnSuspendScheduledTasks() {
+ if (!document_created_)
+ return;
+
+ blink::WebView* view = render_view()->GetWebView();
+ if (view)
+ view->suspendScheduledTasks();
+}
+
+void AtomRenderViewObserver::OnResumeScheduledTasks() {
+ if (!document_created_)
+ return;
+
+ blink::WebView* view = render_view()->GetWebView();
+ if (view)
+ view->resumeScheduledTasks();
+}
+
void AtomRenderViewObserver::OnDestruct() {
delete this;
}
public:
explicit AtomRenderViewObserver(content::RenderView* render_view,
AtomRendererClient* renderer_client);
-
+ void OnSuspendScheduledTasks();
+ void OnResumeScheduledTasks();
protected:
virtual ~AtomRenderViewObserver();
SetLongPollingTimeout(render_view_host);
}
-}
\ No newline at end of file
+void TizenBrowserParts::Suspend(content::RenderViewHost* rvh) {
+ if(!rvh)
+ return;
+
+ rvh->Send(new WrtViewMsg_SuspendScheduledTask(rvh->GetRoutingID()));
+}
+
+void TizenBrowserParts::Resume(content::RenderViewHost* rvh) {
+ if(!rvh)
+ return;
+
+ rvh->Send(new WrtViewMsg_ResumeScheduledTasks(rvh->GetRoutingID()));
+}
+
+}
virtual void Launch(std::unique_ptr<common::AppControl> appcontrol) = 0;
virtual bool launched() const = 0;
void RenderViewCreated(content::RenderViewHost* render_view_host);
+ void Suspend(content::RenderViewHost* rvh);
+ void Resume(content::RenderViewHost* rvh);
void GetCSP(std::string &csp_rule, std::string &csp_report_rule);
void Initialize();
} // namespace tizen
-#endif // TIZEN_BROWSER_TIZEN_BROWSER_PARTS_H_
\ No newline at end of file
+#endif // TIZEN_BROWSER_TIZEN_BROWSER_PARTS_H_