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

Side by Side Diff: ipc/ipc_channel_posix.cc

Issue 5581008: Add a new GetInstance() method for singleton classes, take 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "ipc/ipc_channel_posix.h" 5 #include "ipc/ipc_channel_posix.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // an IPC channel closes and someone attempts to reuse it by name, the 389 // an IPC channel closes and someone attempts to reuse it by name, the
390 // initial channel must not be recycled here. http://crbug.com/26754. 390 // initial channel must not be recycled here. http://crbug.com/26754.
391 static bool used_initial_channel = false; 391 static bool used_initial_channel = false;
392 if (used_initial_channel) { 392 if (used_initial_channel) {
393 LOG(FATAL) << "Denying attempt to reuse initial IPC channel for " 393 LOG(FATAL) << "Denying attempt to reuse initial IPC channel for "
394 << pipe_name_; 394 << pipe_name_;
395 return false; 395 return false;
396 } 396 }
397 used_initial_channel = true; 397 used_initial_channel = true;
398 398
399 pipe_ = Singleton<base::GlobalDescriptors>()->Get(kPrimaryIPCChannel); 399 pipe_ = base::GlobalDescriptors::GetInstance()->Get(kPrimaryIPCChannel);
400 } 400 }
401 } else { 401 } else {
402 waiting_connect_ = mode == MODE_SERVER; 402 waiting_connect_ = mode == MODE_SERVER;
403 } 403 }
404 } 404 }
405 405
406 // Create the Hello message to be sent when Connect is called 406 // Create the Hello message to be sent when Connect is called
407 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE, 407 scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE,
408 HELLO_MESSAGE_TYPE, 408 HELLO_MESSAGE_TYPE,
409 IPC::Message::PRIORITY_NORMAL)); 409 IPC::Message::PRIORITY_NORMAL));
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 1088
1089 bool Channel::Send(Message* message) { 1089 bool Channel::Send(Message* message) {
1090 return channel_impl_->Send(message); 1090 return channel_impl_->Send(message);
1091 } 1091 }
1092 1092
1093 int Channel::GetClientFileDescriptor() const { 1093 int Channel::GetClientFileDescriptor() const {
1094 return channel_impl_->GetClientFileDescriptor(); 1094 return channel_impl_->GetClientFileDescriptor();
1095 } 1095 }
1096 1096
1097 } // namespace IPC 1097 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698