1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ppapi/host/host_message_context.h"
6
7namespace ppapi {
8namespace host {
9
10ReplyMessageContext::ReplyMessageContext()
11    : sync_reply_msg(NULL), routing_id(MSG_ROUTING_NONE) {}
12
13ReplyMessageContext::ReplyMessageContext(
14    const ppapi::proxy::ResourceMessageReplyParams& cp,
15    IPC::Message* sync_reply_msg,
16    int routing_id)
17    : params(cp),
18      sync_reply_msg(sync_reply_msg),
19      routing_id(routing_id) {
20}
21
22ReplyMessageContext::~ReplyMessageContext() {
23}
24
25HostMessageContext::HostMessageContext(
26    const ppapi::proxy::ResourceMessageCallParams& cp)
27    : params(cp),
28      sync_reply_msg(NULL),
29      routing_id(MSG_ROUTING_NONE) {
30}
31
32HostMessageContext::HostMessageContext(
33    int routing_id,
34    const ppapi::proxy::ResourceMessageCallParams& cp)
35    : params(cp),
36      sync_reply_msg(NULL),
37      routing_id(routing_id) {
38}
39
40HostMessageContext::HostMessageContext(
41    const ppapi::proxy::ResourceMessageCallParams& cp,
42    IPC::Message* reply_msg)
43    : params(cp),
44      sync_reply_msg(reply_msg),
45      routing_id(MSG_ROUTING_NONE) {
46}
47
48HostMessageContext::~HostMessageContext() {
49}
50
51ReplyMessageContext HostMessageContext::MakeReplyMessageContext() const {
52  ppapi::proxy::ResourceMessageReplyParams reply_params(params.pp_resource(),
53                                                        params.sequence());
54  return ReplyMessageContext(reply_params, sync_reply_msg, routing_id);
55}
56
57}  // namespace host
58}  // namespace ppapi
59