| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 base::SimpleThread::Join(); | 56 base::SimpleThread::Join(); |
| 57 } | 57 } |
| 58 void Run() override { | 58 void Run() override { |
| 59 ProxyAutoLock acquire; | 59 ProxyAutoLock acquire; |
| 60 // Make a local copy of message_loop_ for this thread so we can interact | 60 // Make a local copy of message_loop_ for this thread so we can interact |
| 61 // with it even after the main thread releases it. | 61 // with it even after the main thread releases it. |
| 62 scoped_refptr<MessageLoopResource> message_loop(message_loop_); | 62 scoped_refptr<MessageLoopResource> message_loop(message_loop_); |
| 63 message_loop->AttachToCurrentThread(); | 63 message_loop->AttachToCurrentThread(); |
| 64 // Note, run releases the lock to run events. | 64 // Note, run releases the lock to run events. |
| 65 message_loop->Run(); | 65 base::RunLoop().Run(); |
| 66 message_loop->DetachFromThread(); | 66 message_loop->DetachFromThread(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 MessageLoopResource* message_loop() { return message_loop_.get(); } | 69 MessageLoopResource* message_loop() { return message_loop_.get(); } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 PP_Instance instance_; | 72 PP_Instance instance_; |
| 73 scoped_refptr<MessageLoopResource> message_loop_; | 73 scoped_refptr<MessageLoopResource> message_loop_; |
| 74 }; | 74 }; |
| 75 | 75 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 resource->ReleaseRef(); | 469 resource->ReleaseRef(); |
| 470 resource->CheckFinalState(); | 470 resource->CheckFinalState(); |
| 471 { | 471 { |
| 472 ProxyAutoLock lock; | 472 ProxyAutoLock lock; |
| 473 resource = nullptr; | 473 resource = nullptr; |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 | 476 |
| 477 } // namespace proxy | 477 } // namespace proxy |
| 478 } // namespace ppapi | 478 } // namespace ppapi |
| OLD | NEW |