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

Side by Side Diff: components/nacl/common/nacl_debug_exception_handler_win.cc

Issue 750263002: Fix implicit conversion of scoped_refptr<T> to T* in components/nacl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « components/nacl/common/nacl_debug_exception_handler_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/nacl_debug_exception_handler_win.h" 5 #include "components/nacl/common/nacl_debug_exception_handler_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 #include "base/win/scoped_handle.h" 9 #include "base/win/scoped_handle.h"
10 #include "native_client/src/trusted/service_runtime/win/debug_exception_handler. h" 10 #include "native_client/src/trusted/service_runtime/win/debug_exception_handler. h"
11 11
12 namespace { 12 namespace {
13 13
14 class DebugExceptionHandler : public base::PlatformThread::Delegate { 14 class DebugExceptionHandler : public base::PlatformThread::Delegate {
15 public: 15 public:
16 DebugExceptionHandler(base::ProcessHandle nacl_process, 16 DebugExceptionHandler(
17 const std::string& startup_info, 17 base::ProcessHandle nacl_process,
18 base::MessageLoopProxy* message_loop, 18 const std::string& startup_info,
19 const base::Callback<void(bool)>& on_connected) 19 const scoped_refptr<base::MessageLoopProxy>& message_loop,
20 const base::Callback<void(bool)>& on_connected)
20 : nacl_process_(nacl_process), 21 : nacl_process_(nacl_process),
21 startup_info_(startup_info), 22 startup_info_(startup_info),
22 message_loop_(message_loop), 23 message_loop_(message_loop),
23 on_connected_(on_connected) { 24 on_connected_(on_connected) {}
24 }
25 25
26 virtual void ThreadMain() override { 26 virtual void ThreadMain() override {
27 // In the Windows API, the set of processes being debugged is 27 // In the Windows API, the set of processes being debugged is
28 // thread-local, so we have to attach to the process (using 28 // thread-local, so we have to attach to the process (using
29 // DebugActiveProcess()) on the same thread on which 29 // DebugActiveProcess()) on the same thread on which
30 // NaClDebugExceptionHandlerRun() receives debug events for the 30 // NaClDebugExceptionHandlerRun() receives debug events for the
31 // process. 31 // process.
32 bool attached = false; 32 bool attached = false;
33 int pid = GetProcessId(nacl_process_.Get()); 33 int pid = GetProcessId(nacl_process_.Get());
34 if (pid == 0) { 34 if (pid == 0) {
(...skipping 12 matching lines...) Expand all
47 nacl_process_.Get(), 47 nacl_process_.Get(),
48 reinterpret_cast<const void*>(startup_info_.data()), 48 reinterpret_cast<const void*>(startup_info_.data()),
49 startup_info_.size()); 49 startup_info_.size());
50 } 50 }
51 delete this; 51 delete this;
52 } 52 }
53 53
54 private: 54 private:
55 base::win::ScopedHandle nacl_process_; 55 base::win::ScopedHandle nacl_process_;
56 std::string startup_info_; 56 std::string startup_info_;
57 base::MessageLoopProxy* message_loop_; 57 const scoped_refptr<base::MessageLoopProxy> message_loop_;
58 base::Callback<void(bool)> on_connected_; 58 base::Callback<void(bool)> on_connected_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(DebugExceptionHandler); 60 DISALLOW_COPY_AND_ASSIGN(DebugExceptionHandler);
61 }; 61 };
62 62
63 } // namespace 63 } // namespace
64 64
65 void NaClStartDebugExceptionHandlerThread( 65 void NaClStartDebugExceptionHandlerThread(
66 base::ProcessHandle nacl_process, 66 base::ProcessHandle nacl_process,
67 const std::string& startup_info, 67 const std::string& startup_info,
68 base::MessageLoopProxy* message_loop, 68 const scoped_refptr<base::MessageLoopProxy>& message_loop,
69 const base::Callback<void(bool)>& on_connected) { 69 const base::Callback<void(bool)>& on_connected) {
70 // The new PlatformThread will take ownership of the 70 // The new PlatformThread will take ownership of the
71 // DebugExceptionHandler object, which will delete itself on exit. 71 // DebugExceptionHandler object, which will delete itself on exit.
72 DebugExceptionHandler* handler = new DebugExceptionHandler( 72 DebugExceptionHandler* handler = new DebugExceptionHandler(
73 nacl_process, startup_info, message_loop, on_connected); 73 nacl_process, startup_info, message_loop, on_connected);
74 if (!base::PlatformThread::CreateNonJoinable(0, handler)) { 74 if (!base::PlatformThread::CreateNonJoinable(0, handler)) {
75 on_connected.Run(false); 75 on_connected.Run(false);
76 delete handler; 76 delete handler;
77 } 77 }
78 } 78 }
OLDNEW
« no previous file with comments | « components/nacl/common/nacl_debug_exception_handler_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698