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

Side by Side Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 621613002: Refactoring: Make IPC::Channel::TakeClientFileDescriptor() a ScopedFD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing Mac build Created 6 years, 2 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
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/ppapi_plugin/ppapi_thread.h" 5 #include "content/ppapi_plugin/ppapi_thread.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/cpu.h" 10 #include "base/cpu.h"
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 if (!init_result) { 485 if (!init_result) {
486 delete dispatcher; 486 delete dispatcher;
487 return false; 487 return false;
488 } 488 }
489 489
490 handle->name = plugin_handle.name; 490 handle->name = plugin_handle.name;
491 #if defined(OS_POSIX) 491 #if defined(OS_POSIX)
492 // On POSIX, transfer ownership of the renderer-side (client) FD. 492 // On POSIX, transfer ownership of the renderer-side (client) FD.
493 // This ensures this process will be notified when it is closed even if a 493 // This ensures this process will be notified when it is closed even if a
494 // connection is not established. 494 // connection is not established.
495 handle->socket = base::FileDescriptor(dispatcher->TakeRendererFD(), true); 495 handle->socket = base::FileDescriptor(dispatcher->TakeRendererFD());
496 if (handle->socket.fd == -1) 496 if (handle->socket.fd == -1)
497 return false; 497 return false;
498 #endif 498 #endif
499 499
500 // From here, the dispatcher will manage its own lifetime according to the 500 // From here, the dispatcher will manage its own lifetime according to the
501 // lifetime of the attached channel. 501 // lifetime of the attached channel.
502 return true; 502 return true;
503 } 503 }
504 504
505 void PpapiThread::SavePluginName(const base::FilePath& path) { 505 void PpapiThread::SavePluginName(const base::FilePath& path) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 std::string("Plugin.Ppapi") + (is_broker_ ? "Broker" : "Plugin") + 543 std::string("Plugin.Ppapi") + (is_broker_ ? "Broker" : "Plugin") +
544 "LoadErrorCode_" + path.BaseName().MaybeAsASCII(); 544 "LoadErrorCode_" + path.BaseName().MaybeAsASCII();
545 545
546 // For sparse histograms, we can use the macro, as it does not incorporate a 546 // For sparse histograms, we can use the macro, as it does not incorporate a
547 // static. 547 // static.
548 UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name, error.code); 548 UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name, error.code);
549 #endif 549 #endif
550 } 550 }
551 551
552 } // namespace content 552 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698