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 "extensions/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 499 |
500 InitOriginPermissions(extension); | 500 InitOriginPermissions(extension); |
501 } | 501 } |
502 | 502 |
503 EnableCustomElementWhiteList(); | 503 EnableCustomElementWhiteList(); |
504 | 504 |
505 is_webkit_initialized_ = true; | 505 is_webkit_initialized_ = true; |
506 } | 506 } |
507 | 507 |
508 void Dispatcher::IdleNotification() { | 508 void Dispatcher::IdleNotification() { |
509 if (is_extension_process_) { | 509 if (is_extension_process_ && forced_idle_timer_) { |
510 // Dampen the forced delay as well if the extension stays idle for long | 510 // Dampen the forced delay as well if the extension stays idle for long |
511 // periods of time. | 511 // periods of time. (forced_idle_timer_ can be NULL after |
| 512 // OnRenderProcessShutdown has been called.) |
512 int64 forced_delay_ms = | 513 int64 forced_delay_ms = |
513 std::max(RenderThread::Get()->GetIdleNotificationDelayInMs(), | 514 std::max(RenderThread::Get()->GetIdleNotificationDelayInMs(), |
514 kMaxExtensionIdleHandlerDelayMs); | 515 kMaxExtensionIdleHandlerDelayMs); |
515 forced_idle_timer_->Stop(); | 516 forced_idle_timer_->Stop(); |
516 forced_idle_timer_->Start( | 517 forced_idle_timer_->Start( |
517 FROM_HERE, | 518 FROM_HERE, |
518 base::TimeDelta::FromMilliseconds(forced_delay_ms), | 519 base::TimeDelta::FromMilliseconds(forced_delay_ms), |
519 RenderThread::Get(), | 520 RenderThread::Get(), |
520 &RenderThread::IdleHandler); | 521 &RenderThread::IdleHandler); |
521 } | 522 } |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 return v8::Handle<v8::Object>(); | 1235 return v8::Handle<v8::Object>(); |
1235 | 1236 |
1236 if (bind_name) | 1237 if (bind_name) |
1237 *bind_name = split.back(); | 1238 *bind_name = split.back(); |
1238 | 1239 |
1239 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1240 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1240 : bind_object; | 1241 : bind_object; |
1241 } | 1242 } |
1242 | 1243 |
1243 } // namespace extensions | 1244 } // namespace extensions |
OLD | NEW |