summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/render_widget_resize_helper_mac.cc
blob: a864d1627d2592f98c993d906f96208d0ec79734 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/renderer_host/render_widget_resize_helper_mac.h"

#include "content/browser/gpu/gpu_process_host_ui_shim.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "ui/accelerated_widget_mac/window_resize_helper_mac.h"

namespace content {
namespace {

void HandleGpuIPC(int gpu_host_id, const IPC::Message& message) {
  GpuProcessHostUIShim* host = GpuProcessHostUIShim::FromID(gpu_host_id);
  if (host)
    host->OnMessageReceived(message);
}

void HandleRendererIPC(int render_process_id, const IPC::Message& message) {
  RenderProcessHost* host = RenderProcessHost::FromID(render_process_id);
  if (host)
    host->OnMessageReceived(message);
}

}  // namespace

////////////////////////////////////////////////////////////////////////////////
// RenderWidgetResizeHelper

// static
void RenderWidgetResizeHelper::PostRendererProcessMsg(int render_process_id,
                                                      const IPC::Message& msg) {
  ui::WindowResizeHelperMac::Get()->task_runner()->PostDelayedTask(
      FROM_HERE, base::Bind(HandleRendererIPC, render_process_id, msg),
      base::TimeDelta());
}

// static
void RenderWidgetResizeHelper::PostGpuProcessMsg(int gpu_host_id,
                                                 const IPC::Message& msg) {
  ui::WindowResizeHelperMac::Get()->task_runner()->PostDelayedTask(
      FROM_HERE, base::Bind(HandleGpuIPC, gpu_host_id, msg), base::TimeDelta());
}

}  // namespace content