| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/html_viewer/blink_platform_impl.h" | 5 #include "components/html_viewer/blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 scoped_ptr<base::WaitableEvent> impl_; | 55 scoped_ptr<base::WaitableEvent> impl_; |
| 56 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl); | 56 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 BlinkPlatformImpl::BlinkPlatformImpl(mojo::ApplicationImpl* app) | 61 BlinkPlatformImpl::BlinkPlatformImpl(mojo::ApplicationImpl* app) |
| 62 : main_loop_(base::MessageLoop::current()), | 62 : shared_timer_func_(NULL), |
| 63 shared_timer_func_(NULL), | |
| 64 shared_timer_fire_time_(0.0), | 63 shared_timer_fire_time_(0.0), |
| 65 shared_timer_fire_time_was_set_while_suspended_(false), | 64 shared_timer_fire_time_was_set_while_suspended_(false), |
| 66 shared_timer_suspended_(0), | 65 shared_timer_suspended_(0), |
| 67 current_thread_slot_(&DestroyCurrentThread), | 66 current_thread_slot_(&DestroyCurrentThread), |
| 68 scheduler_(main_loop_->message_loop_proxy()) { | 67 scheduler_(base::ThreadTaskRunnerHandle::Get()) { |
| 69 if (app) { | 68 if (app) { |
| 70 app->ConnectToService("mojo:network_service", &network_service_); | 69 app->ConnectToService("mojo:network_service", &network_service_); |
| 71 | 70 |
| 72 mojo::CookieStorePtr cookie_store; | 71 mojo::CookieStorePtr cookie_store; |
| 73 network_service_->GetCookieStore(GetProxy(&cookie_store)); | 72 network_service_->GetCookieStore(GetProxy(&cookie_store)); |
| 74 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); | 73 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); |
| 75 | 74 |
| 76 mojo::ServiceProviderPtr service_provider; | 75 mojo::ServiceProviderPtr service_provider; |
| 77 app->ConnectToService("mojo:core_services", &service_provider); | 76 app->ConnectToService("mojo:core_services", &service_provider); |
| 78 mojo::ClipboardPtr clipboard; | 77 mojo::ClipboardPtr clipboard; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 156 |
| 158 shared_timer_.Stop(); | 157 shared_timer_.Stop(); |
| 159 shared_timer_.Start(FROM_HERE, base::TimeDelta::FromMicroseconds(interval), | 158 shared_timer_.Start(FROM_HERE, base::TimeDelta::FromMicroseconds(interval), |
| 160 this, &BlinkPlatformImpl::DoTimeout); | 159 this, &BlinkPlatformImpl::DoTimeout); |
| 161 } | 160 } |
| 162 | 161 |
| 163 void BlinkPlatformImpl::stopSharedTimer() { | 162 void BlinkPlatformImpl::stopSharedTimer() { |
| 164 shared_timer_.Stop(); | 163 shared_timer_.Stop(); |
| 165 } | 164 } |
| 166 | 165 |
| 167 void BlinkPlatformImpl::callOnMainThread( | |
| 168 void (*func)(void*), void* context) { | |
| 169 main_loop_->PostTask(FROM_HERE, base::Bind(func, context)); | |
| 170 } | |
| 171 | |
| 172 bool BlinkPlatformImpl::isThreadedCompositingEnabled() { | 166 bool BlinkPlatformImpl::isThreadedCompositingEnabled() { |
| 173 return true; | 167 return true; |
| 174 } | 168 } |
| 175 | 169 |
| 176 blink::WebCompositorSupport* BlinkPlatformImpl::compositorSupport() { | 170 blink::WebCompositorSupport* BlinkPlatformImpl::compositorSupport() { |
| 177 return &compositor_support_; | 171 return &compositor_support_; |
| 178 } | 172 } |
| 179 | 173 |
| 180 void BlinkPlatformImpl::createMessageChannel( | 174 void BlinkPlatformImpl::createMessageChannel( |
| 181 blink::WebMessagePortChannel** channel1, | 175 blink::WebMessagePortChannel** channel1, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 } | 311 } |
| 318 | 312 |
| 319 // static | 313 // static |
| 320 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 314 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
| 321 WebThreadImplForMessageLoop* impl = | 315 WebThreadImplForMessageLoop* impl = |
| 322 static_cast<WebThreadImplForMessageLoop*>(thread); | 316 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 323 delete impl; | 317 delete impl; |
| 324 } | 318 } |
| 325 | 319 |
| 326 } // namespace html_viewer | 320 } // namespace html_viewer |
| OLD | NEW |