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

Side by Side Diff: mojo/message_pump/message_pump_mojo.cc

Issue 2069663002: Some scoped_ptr -> std::unique_ptr conversion, especially under //mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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
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 "mojo/message_pump/message_pump_mojo.h" 5 #include "mojo/message_pump/message_pump_mojo.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/debug/alias.h" 11 #include "base/debug/alias.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/threading/thread_local.h" 13 #include "base/threading/thread_local.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "mojo/message_pump/message_pump_mojo_handler.h" 15 #include "mojo/message_pump/message_pump_mojo_handler.h"
15 #include "mojo/message_pump/time_helper.h" 16 #include "mojo/message_pump/time_helper.h"
16 #include "mojo/public/cpp/system/message_pipe.h" 17 #include "mojo/public/cpp/system/message_pipe.h"
17 #include "mojo/public/cpp/system/wait.h" 18 #include "mojo/public/cpp/system/wait.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 CreateMessagePipe(nullptr, &read_handle, &write_handle); 51 CreateMessagePipe(nullptr, &read_handle, &write_handle);
51 } 52 }
52 53
53 base::TimeTicks delayed_work_time; 54 base::TimeTicks delayed_work_time;
54 55
55 // Used to wake up WaitForWork(). 56 // Used to wake up WaitForWork().
56 ScopedMessagePipeHandle read_handle; 57 ScopedMessagePipeHandle read_handle;
57 ScopedMessagePipeHandle write_handle; 58 ScopedMessagePipeHandle write_handle;
58 59
59 // Cached structures to avoid the heap allocation cost of std::vector<>. 60 // Cached structures to avoid the heap allocation cost of std::vector<>.
60 scoped_ptr<WaitState> wait_state; 61 std::unique_ptr<WaitState> wait_state;
61 scoped_ptr<HandleToHandlerList> cloned_handlers; 62 std::unique_ptr<HandleToHandlerList> cloned_handlers;
62 63
63 bool should_quit; 64 bool should_quit;
64 }; 65 };
65 66
66 MessagePumpMojo::MessagePumpMojo() : run_state_(nullptr), next_handler_id_(0) { 67 MessagePumpMojo::MessagePumpMojo() : run_state_(nullptr), next_handler_id_(0) {
67 DCHECK(!current()) 68 DCHECK(!current())
68 << "There is already a MessagePumpMojo instance on this thread."; 69 << "There is already a MessagePumpMojo instance on this thread.";
69 CurrentPump()->Set(this); 70 CurrentPump()->Set(this);
70 } 71 }
71 72
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 void MessagePumpMojo::WillSignalHandler() { 330 void MessagePumpMojo::WillSignalHandler() {
330 FOR_EACH_OBSERVER(Observer, observers_, WillSignalHandler()); 331 FOR_EACH_OBSERVER(Observer, observers_, WillSignalHandler());
331 } 332 }
332 333
333 void MessagePumpMojo::DidSignalHandler() { 334 void MessagePumpMojo::DidSignalHandler() {
334 FOR_EACH_OBSERVER(Observer, observers_, DidSignalHandler()); 335 FOR_EACH_OBSERVER(Observer, observers_, DidSignalHandler());
335 } 336 }
336 337
337 } // namespace common 338 } // namespace common
338 } // namespace mojo 339 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/message_pump/handle_watcher_unittest.cc ('k') | mojo/message_pump/message_pump_mojo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698