Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: ppapi/proxy/message_handler.h

Issue 1864293002: Convert //ppapi to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more nullptr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/proxy/media_stream_video_track_resource.cc ('k') | ppapi/proxy/message_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_PROXY_MESSAGE_HANDLER_H_ 5 #ifndef PPAPI_PROXY_MESSAGE_HANDLER_H_
6 #define PPAPI_PROXY_MESSAGE_HANDLER_H_ 6 #define PPAPI_PROXY_MESSAGE_HANDLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
11
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "ppapi/c/pp_resource.h" 14 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/ppp_message_handler.h" 15 #include "ppapi/c/ppp_message_handler.h"
15 #include "ppapi/proxy/ppapi_proxy_export.h" 16 #include "ppapi/proxy/ppapi_proxy_export.h"
16 17
17 namespace IPC { 18 namespace IPC {
18 class Message; 19 class Message;
19 } 20 }
20 21
21 namespace ppapi { 22 namespace ppapi {
22 23
(...skipping 14 matching lines...) Expand all
37 // the function pointers within must be valid, or we fail 38 // the function pointers within must be valid, or we fail
38 // with PP_ERROR_BADARGUMENT. 39 // with PP_ERROR_BADARGUMENT.
39 // |user_data| is a pointer provided by the plugin that we pass back when we 40 // |user_data| is a pointer provided by the plugin that we pass back when we
40 // call functions in |handler_if|. 41 // call functions in |handler_if|.
41 // |message_loop| is the message loop where we will invoke functions in 42 // |message_loop| is the message loop where we will invoke functions in
42 // |handler_if|. Must not be the main thread message loop, 43 // |handler_if|. Must not be the main thread message loop,
43 // to try to force the plugin to not over-subscribe the main 44 // to try to force the plugin to not over-subscribe the main
44 // thread. If it's the main thread loop, |error| will be set 45 // thread. If it's the main thread loop, |error| will be set
45 // to PP_ERROR_WRONGTHREAD. 46 // to PP_ERROR_WRONGTHREAD.
46 // |error| is an out-param that will be set on failure. 47 // |error| is an out-param that will be set on failure.
47 static scoped_ptr<MessageHandler> Create( 48 static std::unique_ptr<MessageHandler> Create(
48 PP_Instance instance, 49 PP_Instance instance,
49 const PPP_MessageHandler_0_2* handler_if, 50 const PPP_MessageHandler_0_2* handler_if,
50 void* user_data, 51 void* user_data,
51 PP_Resource message_loop, 52 PP_Resource message_loop,
52 int32_t* error); 53 int32_t* error);
53 ~MessageHandler(); 54 ~MessageHandler();
54 55
55 bool LoopIsValid() const; 56 bool LoopIsValid() const;
56 57
57 void HandleMessage(ScopedPPVar var); 58 void HandleMessage(ScopedPPVar var);
58 void HandleBlockingMessage(ScopedPPVar var, 59 void HandleBlockingMessage(ScopedPPVar var,
59 scoped_ptr<IPC::Message> reply_msg); 60 std::unique_ptr<IPC::Message> reply_msg);
60 61
61 private: 62 private:
62 MessageHandler(PP_Instance instance, 63 MessageHandler(PP_Instance instance,
63 const PPP_MessageHandler_0_2* handler_if, 64 const PPP_MessageHandler_0_2* handler_if,
64 void* user_data, 65 void* user_data,
65 scoped_refptr<MessageLoopResource> message_loop); 66 scoped_refptr<MessageLoopResource> message_loop);
66 PP_Instance instance_; 67 PP_Instance instance_;
67 const PPP_MessageHandler_0_2* handler_if_; 68 const PPP_MessageHandler_0_2* handler_if_;
68 void* user_data_; 69 void* user_data_;
69 scoped_refptr<MessageLoopResource> message_loop_; 70 scoped_refptr<MessageLoopResource> message_loop_;
70 71
71 DISALLOW_COPY_AND_ASSIGN(MessageHandler); 72 DISALLOW_COPY_AND_ASSIGN(MessageHandler);
72 }; 73 };
73 74
74 } // namespace proxy 75 } // namespace proxy
75 } // namespace ppapi 76 } // namespace ppapi
76 77
77 #endif // PPAPI_PROXY_MESSAGE_HANDLER_H_ 78 #endif // PPAPI_PROXY_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/media_stream_video_track_resource.cc ('k') | ppapi/proxy/message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698