Chromium Code Reviews| Index: content/browser/loader/resource_scheduler_filter.cc |
| diff --git a/content/browser/loader/resource_scheduler_filter.cc b/content/browser/loader/resource_scheduler_filter.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cbd388da2a428a0d2a6771876234e50081e23e75 |
| --- /dev/null |
| +++ b/content/browser/loader/resource_scheduler_filter.cc |
| @@ -0,0 +1,53 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/loader/resource_scheduler_filter.h" |
| + |
| +#include "content/browser/loader/resource_dispatcher_host_impl.h" |
| +#include "content/browser/loader/resource_scheduler.h" |
| +#include "content/common/view_messages.h" |
| +#include "content/public/common/page_transition_types.h" |
| + |
| +namespace content { |
| + |
| +ResourceSchedulerFilter::ResourceSchedulerFilter(int child_id) |
| + : child_id_(child_id), |
| + resource_scheduler_(ResourceDispatcherHostImpl::Get()->scheduler()) { |
| +} |
| + |
| +ResourceSchedulerFilter::~ResourceSchedulerFilter() { |
| +} |
| + |
| +bool ResourceSchedulerFilter::OnMessageReceived(const IPC::Message& message, |
| + bool* message_was_ok) { |
| + switch (message.type()) { |
| + case ViewHostMsg_RenderViewReady::ID: |
| + resource_scheduler_->OnCreate(child_id_, message.routing_id()); |
| + break; |
| + |
| + case ViewHostMsg_FrameNavigate::ID: { |
| + PickleIterator iter(message); |
| + ViewHostMsg_FrameNavigate_Params params; |
| + if (!IPC::ParamTraits<ViewHostMsg_FrameNavigate_Params>::Read( |
| + &message, &iter, ¶ms)) { |
| + break; |
| + } |
| + if (PageTransitionIsMainFrame(params.transition)) { |
| + resource_scheduler_->OnNavigate(child_id_, message.routing_id()); |
|
darin (slow to review)
2012/12/18 21:09:56
Perhaps OnNavigate and OnFirstPaint should return
|
| + } |
| + break; |
| + } |
| + |
| + case ViewHostMsg_DidFirstPaint::ID: |
| + resource_scheduler_->OnFirstPaint(child_id_, message.routing_id()); |
| + break; |
| + |
| + default: |
| + break; |
| + } |
| + |
| + return false; |
| +} |
| + |
| +} // namespace content |