OLD | NEW |
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 "ppapi/utility/threading/simple_thread.h" | 5 #include "ppapi/utility/threading/simple_thread.h" |
6 | 6 |
7 #ifdef WIN32 | 7 #ifdef WIN32 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 data->func(data->message_loop, data->user_data); | 31 data->func(data->message_loop, data->user_data); |
32 else | 32 else |
33 data->message_loop.Run(); | 33 data->message_loop.Run(); |
34 | 34 |
35 delete data; | 35 delete data; |
36 return NULL; | 36 return NULL; |
37 } | 37 } |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 SimpleThread::SimpleThread(Instance* instance) | 41 SimpleThread::SimpleThread(const InstanceHandle& instance) |
42 : instance_(instance), | 42 : instance_(instance), |
43 message_loop_(instance), | 43 message_loop_(instance), |
44 thread_(0) { | 44 thread_(0) { |
45 } | 45 } |
46 | 46 |
47 SimpleThread::~SimpleThread() { | 47 SimpleThread::~SimpleThread() { |
48 Join(); | 48 Join(); |
49 } | 49 } |
50 | 50 |
51 bool SimpleThread::Start() { | 51 bool SimpleThread::Start() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 #else | 87 #else |
88 if (pthread_create(&thread_, NULL, &RunThread, data) != 0) { | 88 if (pthread_create(&thread_, NULL, &RunThread, data) != 0) { |
89 #endif | 89 #endif |
90 delete data; | 90 delete data; |
91 return false; | 91 return false; |
92 } | 92 } |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 } // namespace pp | 96 } // namespace pp |
OLD | NEW |