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

Side by Side Diff: components/nacl/loader/nacl_ipc_adapter.cc

Issue 307653003: Introduce IPC::Channel::Create*() to ensure it being heap-allocated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing windows build, landing again. Created 6 years, 6 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 "components/nacl/loader/nacl_ipc_adapter.h" 5 #include "components/nacl/loader/nacl_ipc_adapter.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 NaClIPCAdapter::IOThreadData::~IOThreadData() { 323 NaClIPCAdapter::IOThreadData::~IOThreadData() {
324 } 324 }
325 325
326 NaClIPCAdapter::NaClIPCAdapter(const IPC::ChannelHandle& handle, 326 NaClIPCAdapter::NaClIPCAdapter(const IPC::ChannelHandle& handle,
327 base::TaskRunner* runner) 327 base::TaskRunner* runner)
328 : lock_(), 328 : lock_(),
329 cond_var_(&lock_), 329 cond_var_(&lock_),
330 task_runner_(runner), 330 task_runner_(runner),
331 locked_data_() { 331 locked_data_() {
332 io_thread_data_.channel_.reset( 332 io_thread_data_.channel_ = IPC::Channel::CreateServer(handle, this);
333 new IPC::Channel(handle, IPC::Channel::MODE_SERVER, this));
334 // Note, we can not PostTask for ConnectChannelOnIOThread here. If we did, 333 // Note, we can not PostTask for ConnectChannelOnIOThread here. If we did,
335 // and that task ran before this constructor completes, the reference count 334 // and that task ran before this constructor completes, the reference count
336 // would go to 1 and then to 0 because of the Task, before we've been returned 335 // would go to 1 and then to 0 because of the Task, before we've been returned
337 // to the owning scoped_refptr, which is supposed to give us our first 336 // to the owning scoped_refptr, which is supposed to give us our first
338 // ref-count. 337 // ref-count.
339 } 338 }
340 339
341 NaClIPCAdapter::NaClIPCAdapter(scoped_ptr<IPC::Channel> channel, 340 NaClIPCAdapter::NaClIPCAdapter(scoped_ptr<IPC::Channel> channel,
342 base::TaskRunner* runner) 341 base::TaskRunner* runner)
343 : lock_(), 342 : lock_(),
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 header.flags = msg.flags(); 664 header.flags = msg.flags();
666 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); 665 header.num_fds = static_cast<int>(rewritten_msg->desc_count());
667 666
668 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); 667 rewritten_msg->SetData(header, msg.payload(), msg.payload_size());
669 locked_data_.to_be_received_.push(rewritten_msg); 668 locked_data_.to_be_received_.push(rewritten_msg);
670 } 669 }
671 670
672 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { 671 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) {
673 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); 672 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags);
674 } 673 }
OLDNEW
« no previous file with comments | « components/nacl/broker/nacl_broker_listener.cc ('k') | content/browser/plugin_data_remover_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698