| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/ppapi_plugin/ppapi_webkit_thread.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "content/ppapi_plugin/ppapi_webkitplatformsupport_impl.h" | |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | |
| 10 | |
| 11 PpapiWebKitThread::PpapiWebKitThread() { | |
| 12 DCHECK(!webkit_thread_.get()); | |
| 13 | |
| 14 webkit_thread_.reset(new InternalWebKitThread); | |
| 15 bool started = webkit_thread_->Start(); | |
| 16 DCHECK(started); | |
| 17 } | |
| 18 | |
| 19 PpapiWebKitThread::~PpapiWebKitThread() { | |
| 20 } | |
| 21 | |
| 22 void PpapiWebKitThread::PostTask(const tracked_objects::Location& from_here, | |
| 23 const base::Closure& task) { | |
| 24 webkit_thread_->message_loop()->PostTask(from_here, task); | |
| 25 } | |
| 26 | |
| 27 PpapiWebKitThread::InternalWebKitThread::InternalWebKitThread() | |
| 28 : base::Thread("PPAPIWebKit") { | |
| 29 } | |
| 30 | |
| 31 PpapiWebKitThread::InternalWebKitThread::~InternalWebKitThread() { | |
| 32 Stop(); | |
| 33 } | |
| 34 | |
| 35 void PpapiWebKitThread::InternalWebKitThread::Init() { | |
| 36 DCHECK(!webkit_platform_support_.get()); | |
| 37 webkit_platform_support_.reset(new PpapiWebKitPlatformSupportImpl); | |
| 38 WebKit::initialize(webkit_platform_support_.get()); | |
| 39 } | |
| 40 | |
| 41 void PpapiWebKitThread::InternalWebKitThread::CleanUp() { | |
| 42 DCHECK(webkit_platform_support_.get()); | |
| 43 WebKit::shutdown(); | |
| 44 } | |
| OLD | NEW |