Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: android_webview/renderer/view_renderer.cc

Issue 16796002: Delete the browser-compositor webview render mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/renderer/view_renderer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 "android_webview/renderer/view_renderer.h"
6
7 #include "android_webview/common/aw_switches.h"
8 #include "android_webview/common/render_view_messages.h"
9 #include "android_webview/common/renderer_picture_map.h"
10 #include "base/command_line.h"
11 #include "content/public/renderer/render_view.h"
12 #include "skia/ext/refptr.h"
13
14 namespace android_webview {
15
16 // static
17 void ViewRenderer::RenderViewCreated(content::RenderView* render_view) {
18 if (CommandLine::ForCurrentProcess()->HasSwitch(
19 switches::kNoMergeUIAndRendererCompositorThreads)) {
20 new ViewRenderer(render_view); // |render_view| takes ownership.
21 }
22 }
23
24 ViewRenderer::ViewRenderer(content::RenderView* render_view)
25 : content::RenderViewObserver(render_view),
26 // TODO(leandrogracia): default to false when SW mode uses Ubercompositor.
27 // Until then we need picture updates enabled for SW mode invalidation.
28 // http://crbug.com/170086.
29 capture_picture_enabled_(true) {
30 }
31
32 ViewRenderer::~ViewRenderer() {
33 RendererPictureMap::GetInstance()->ClearRendererPicture(routing_id());
34 }
35
36 bool ViewRenderer::OnMessageReceived(const IPC::Message& message) {
37 bool handled = true;
38 IPC_BEGIN_MESSAGE_MAP(ViewRenderer, message)
39 IPC_MESSAGE_HANDLER(AwViewMsg_EnableCapturePictureCallback,
40 OnEnableCapturePictureCallback)
41 IPC_MESSAGE_HANDLER(AwViewMsg_CapturePictureSync,
42 OnCapturePictureSync)
43 IPC_MESSAGE_UNHANDLED(handled = false)
44 IPC_END_MESSAGE_MAP()
45 return handled;
46 }
47
48 void ViewRenderer::DidCommitCompositorFrame() {
49 if (!capture_picture_enabled_)
50 return;
51
52 skia::RefPtr<SkPicture> picture = render_view()->CapturePicture();
53 RendererPictureMap::GetInstance()->SetRendererPicture(routing_id(), picture);
54 Send(new AwViewHostMsg_PictureUpdated(routing_id()));
55 }
56
57 void ViewRenderer::OnEnableCapturePictureCallback(bool enable) {
58 capture_picture_enabled_ = enable;
59 }
60
61 void ViewRenderer::OnCapturePictureSync() {
62 RendererPictureMap::GetInstance()->SetRendererPicture(
63 routing_id(), render_view()->CapturePicture());
64 }
65
66 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/renderer/view_renderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698