summaryrefslogtreecommitdiffstats
path: root/chrome/common/worker_messages.cc
blob: 19b8d2312f2fb9506d0a1e3827ee120a17299c94 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Copyright (c) 2010 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 "chrome/common/common_param_traits.h"

#define IPC_MESSAGE_IMPL
#include "chrome/common/worker_messages.h"

WorkerHostMsg_PostConsoleMessageToWorkerObject_Params::
WorkerHostMsg_PostConsoleMessageToWorkerObject_Params()
    : source_identifier(-1),
      message_type(-1),
      message_level(-1),
      line_number(-1) {
}

WorkerHostMsg_PostConsoleMessageToWorkerObject_Params::
~WorkerHostMsg_PostConsoleMessageToWorkerObject_Params() {
}

WorkerProcessMsg_CreateWorker_Params::WorkerProcessMsg_CreateWorker_Params()
    : is_shared(false),
      route_id(-1),
      creator_process_id(-1),
      creator_appcache_host_id(-1),
      shared_worker_appcache_id(-1) {
}

WorkerProcessMsg_CreateWorker_Params::~WorkerProcessMsg_CreateWorker_Params() {
}


namespace IPC {

void ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params>::Write(
    Message* m, const param_type& p) {
  WriteParam(m, p.source_identifier);
  WriteParam(m, p.message_type);
  WriteParam(m, p.message_level);
  WriteParam(m, p.message);
  WriteParam(m, p.line_number);
  WriteParam(m, p.source_url);
}

bool ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params>::Read(
    const Message* m, void** iter, param_type* p) {
  return
      ReadParam(m, iter, &p->source_identifier) &&
      ReadParam(m, iter, &p->message_type) &&
      ReadParam(m, iter, &p->message_level) &&
      ReadParam(m, iter, &p->message) &&
      ReadParam(m, iter, &p->line_number) &&
      ReadParam(m, iter, &p->source_url);
}

void ParamTraits<WorkerHostMsg_PostConsoleMessageToWorkerObject_Params>::Log(
    const param_type& p, std::string* l) {
  l->append("(");
  LogParam(p.source_identifier, l);
  l->append(", ");
  LogParam(p.message_type, l);
  l->append(", ");
  LogParam(p.message_level, l);
  l->append(", ");
  LogParam(p.message, l);
  l->append(", ");
  LogParam(p.line_number, l);
  l->append(", ");
  LogParam(p.source_url, l);
  l->append(")");
}

void ParamTraits<WorkerProcessMsg_CreateWorker_Params>::Write(
    Message* m, const param_type& p) {
  WriteParam(m, p.url);
  WriteParam(m, p.is_shared);
  WriteParam(m, p.name);
  WriteParam(m, p.route_id);
  WriteParam(m, p.creator_process_id);
  WriteParam(m, p.creator_appcache_host_id);
  WriteParam(m, p.shared_worker_appcache_id);
}

bool ParamTraits<WorkerProcessMsg_CreateWorker_Params>::Read(const Message* m,
                                                             void** iter,
                                                             param_type* p) {
  return
      ReadParam(m, iter, &p->url) &&
      ReadParam(m, iter, &p->is_shared) &&
      ReadParam(m, iter, &p->name) &&
      ReadParam(m, iter, &p->route_id) &&
      ReadParam(m, iter, &p->creator_process_id) &&
      ReadParam(m, iter, &p->creator_appcache_host_id) &&
      ReadParam(m, iter, &p->shared_worker_appcache_id);
}

void ParamTraits<WorkerProcessMsg_CreateWorker_Params>::Log(const param_type& p,
                                                            std::string* l) {
  l->append("(");
  LogParam(p.url, l);
  l->append(", ");
  LogParam(p.is_shared, l);
  l->append(", ");
  LogParam(p.name, l);
  l->append(", ");
  LogParam(p.route_id, l);
  l->append(", ");
  LogParam(p.creator_process_id, l);
  l->append(", ");
  LogParam(p.creator_appcache_host_id, l);
  l->append(", ");
  LogParam(p.shared_worker_appcache_id, l);
  l->append(")");
}

}  // namespace IPC