Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / remoting / client / plugin / pepper_util.h
blob63c0bce2329a2a419753437e1427801909a9aab5
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.
5 #ifndef REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_
6 #define REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_
8 #include "base/basictypes.h"
9 #include "base/callback_forward.h"
11 #include "ppapi/cpp/completion_callback.h"
13 struct PP_NetAddress_Private;
15 namespace talk_base {
16 class SocketAddress;
17 } // namespace talk_base
19 namespace remoting {
21 // Adapts a base::Callback to a pp::CompletionCallback, which may be passed to
22 // exactly one Pepper API. If the adapted callback is not used then a copy of
23 // |callback| will be leaked, including references & passed values bound to it.
24 // Pepper guarantees that each completion callback is called once and only once
25 // (aborted callbacks are called with PP_ABOIRTED), so there should be no leaks
26 // as long as the result of this function is passed to Pepper.
27 pp::CompletionCallback PpCompletionCallback(base::Callback<void(int)> callback);
29 // Helpers to convert between different socket address representations.
30 bool SocketAddressToPpAddressWithPort(const talk_base::SocketAddress& address,
31 PP_NetAddress_Private* pp_address,
32 uint16_t port);
33 bool SocketAddressToPpAddress(const talk_base::SocketAddress& address,
34 PP_NetAddress_Private* pp_address);
35 bool PpAddressToSocketAddress(const PP_NetAddress_Private& pp_address,
36 talk_base::SocketAddress* address);
38 } // namespace remoting
40 #endif // REMOTING_CLIENT_PLUGIN_PLUGIN_UTIL_H_