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

Side by Side Diff: content/public/test/render_view_fake_resources_test.cc

Issue 10911297: Modify AsyncResourceHandler to use a single shared memory buffer (in ring (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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/public/test/render_view_fake_resources_test.h" 5 #include "content/public/test/render_view_fake_resources_test.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ASSERT_TRUE(channel_->Send(new ResourceMsg_ReceivedResponse( 161 ASSERT_TRUE(channel_->Send(new ResourceMsg_ReceivedResponse(
162 message.routing_id(), request_id, response_head))); 162 message.routing_id(), request_id, response_head)));
163 163
164 base::SharedMemory shared_memory; 164 base::SharedMemory shared_memory;
165 ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(body.size())); 165 ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(body.size()));
166 memcpy(shared_memory.memory(), body.data(), body.size()); 166 memcpy(shared_memory.memory(), body.data(), body.size());
167 167
168 base::SharedMemoryHandle handle; 168 base::SharedMemoryHandle handle;
169 ASSERT_TRUE(shared_memory.GiveToProcess(base::Process::Current().handle(), 169 ASSERT_TRUE(shared_memory.GiveToProcess(base::Process::Current().handle(),
170 &handle)); 170 &handle));
171
172 ASSERT_TRUE(channel_->Send(new ResourceMsg_SetDataBuffer(
173 message.routing_id(),
174 request_id,
175 handle,
176 body.size())));
177
171 ASSERT_TRUE(channel_->Send(new ResourceMsg_DataReceived( 178 ASSERT_TRUE(channel_->Send(new ResourceMsg_DataReceived(
172 message.routing_id(), 179 message.routing_id(),
173 request_id, 180 request_id,
174 handle, 181 0,
175 body.size(), 182 body.size(),
176 body.size()))); 183 body.size())));
177 184
178 ASSERT_TRUE(channel_->Send(new ResourceMsg_RequestComplete( 185 ASSERT_TRUE(channel_->Send(new ResourceMsg_RequestComplete(
179 message.routing_id(), 186 message.routing_id(),
180 request_id, 187 request_id,
181 net::OK, 188 net::OK,
182 false, 189 false,
183 std::string(), 190 std::string(),
184 base::TimeTicks()))); 191 base::TimeTicks())));
(...skipping 21 matching lines...) Expand all
206 params.url = GURL(history_item.urlString()); 213 params.url = GURL(history_item.urlString());
207 params.transition = PAGE_TRANSITION_FORWARD_BACK; 214 params.transition = PAGE_TRANSITION_FORWARD_BACK;
208 params.state = webkit_glue::HistoryItemToString(history_item); 215 params.state = webkit_glue::HistoryItemToString(history_item);
209 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; 216 params.navigation_type = ViewMsg_Navigate_Type::NORMAL;
210 params.request_time = base::Time::Now(); 217 params.request_time = base::Time::Now();
211 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); 218 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params));
212 message_loop_.Run(); 219 message_loop_.Run();
213 } 220 }
214 221
215 } // namespace content 222 } // namespace content
OLDNEW
« content/browser/renderer_host/async_resource_handler.cc ('K') | « content/content_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698