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

Side by Side Diff: content/renderer/pepper/pepper_browser_connection.cc

Issue 21966004: Pepper: Move FileRef to the "new" resource proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove code duplication Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/renderer/pepper/pepper_browser_connection.h" 5 #include "content/renderer/pepper/pepper_browser_connection.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 17 matching lines...) Expand all
28 28
29 bool PepperBrowserConnection::OnMessageReceived(const IPC::Message& msg) { 29 bool PepperBrowserConnection::OnMessageReceived(const IPC::Message& msg) {
30 // Check if the message is an in-process reply. 30 // Check if the message is an in-process reply.
31 if (PepperInProcessRouter::OnPluginMsgReceived(msg)) 31 if (PepperInProcessRouter::OnPluginMsgReceived(msg))
32 return true; 32 return true;
33 33
34 bool handled = true; 34 bool handled = true;
35 IPC_BEGIN_MESSAGE_MAP(PepperBrowserConnection, msg) 35 IPC_BEGIN_MESSAGE_MAP(PepperBrowserConnection, msg)
36 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostFromHostReply, 36 IPC_MESSAGE_HANDLER(PpapiHostMsg_CreateResourceHostFromHostReply,
37 OnMsgCreateResourceHostFromHostReply) 37 OnMsgCreateResourceHostFromHostReply)
38 IPC_MESSAGE_HANDLER(PpapiHostMsg_FileRef_GetInfoForRendererReply,
39 OnMsgFileRefGetInfoReply)
38 IPC_MESSAGE_UNHANDLED(handled = false) 40 IPC_MESSAGE_UNHANDLED(handled = false)
39 IPC_END_MESSAGE_MAP() 41 IPC_END_MESSAGE_MAP()
40
41 return handled; 42 return handled;
42 } 43 }
43 44
44 void PepperBrowserConnection::DidCreateInProcessInstance( 45 void PepperBrowserConnection::DidCreateInProcessInstance(
45 PP_Instance instance, 46 PP_Instance instance,
46 int render_view_id, 47 int render_view_id,
47 const GURL& document_url, 48 const GURL& document_url,
48 const GURL& plugin_url) { 49 const GURL& plugin_url) {
49 Send(new ViewHostMsg_DidCreateInProcessInstance( 50 Send(new ViewHostMsg_DidCreateInProcessInstance(
50 instance, 51 instance,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (it != pending_create_map_.end()) { 96 if (it != pending_create_map_.end()) {
96 it->second.Run(pending_resource_host_id); 97 it->second.Run(pending_resource_host_id);
97 pending_create_map_.erase(it); 98 pending_create_map_.erase(it);
98 } else { 99 } else {
99 NOTREACHED(); 100 NOTREACHED();
100 } 101 }
101 } 102 }
102 103
103 void PepperBrowserConnection::OnMsgFileRefGetInfoReply( 104 void PepperBrowserConnection::OnMsgFileRefGetInfoReply(
104 int32_t sequence_number, 105 int32_t sequence_number,
105 const std::vector<PP_Resource>& resources, 106 const std::vector<ppapi::FileRef_DetailedInfo>& infos) {
106 const std::vector<PP_FileSystemType>& types,
107 const std::vector<std::string>& file_system_url_specs,
108 const std::vector<base::FilePath>& external_paths) {
109 // Check that the message is destined for the plugin this object is associated 107 // Check that the message is destined for the plugin this object is associated
110 // with. 108 // with.
111 std::map<int32_t, FileRefGetInfoCallback>::iterator it = 109 std::map<int32_t, FileRefGetInfoCallback>::iterator it =
112 get_info_map_.find(sequence_number); 110 get_info_map_.find(sequence_number);
113 if (it != get_info_map_.end()) { 111 if (it != get_info_map_.end()) {
114 FileRefGetInfoCallback callback = it->second; 112 FileRefGetInfoCallback callback = it->second;
115 get_info_map_.erase(it); 113 get_info_map_.erase(it);
116 callback.Run(resources, types, file_system_url_specs, external_paths); 114 callback.Run(infos);
117 } else { 115 } else {
118 NOTREACHED(); 116 NOTREACHED();
119 } 117 }
120 } 118 }
121 119
122 int32_t PepperBrowserConnection::GetNextSequence() { 120 int32_t PepperBrowserConnection::GetNextSequence() {
123 // Return the value with wraparound, making sure we don't make a sequence 121 // Return the value with wraparound, making sure we don't make a sequence
124 // number with a 0 ID. Note that signed wraparound is undefined in C++ so we 122 // number with a 0 ID. Note that signed wraparound is undefined in C++ so we
125 // manually check. 123 // manually check.
126 int32_t ret = next_sequence_number_; 124 int32_t ret = next_sequence_number_;
127 if (next_sequence_number_ == std::numeric_limits<int32_t>::max()) 125 if (next_sequence_number_ == std::numeric_limits<int32_t>::max())
128 next_sequence_number_ = 1; // Skip 0 which is invalid. 126 next_sequence_number_ = 1; // Skip 0 which is invalid.
129 else 127 else
130 next_sequence_number_++; 128 next_sequence_number_++;
131 return ret; 129 return ret;
132 } 130 }
133 131
134 } // namespace content 132 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698