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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 11787031: Fix hang in Android WebView release build tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Factor out check and add LOG(WARNING) when fails. Created 7 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <sys/system_properties.h> 7 #include <sys/system_properties.h>
8 8
9 #include "android_webview/browser/aw_browser_main_parts.h" 9 #include "android_webview/browser/aw_browser_main_parts.h"
10 #include "android_webview/browser/net_disk_cache_remover.h" 10 #include "android_webview/browser/net_disk_cache_remover.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return NULL; 98 return NULL;
99 AwContentsUserData* data = reinterpret_cast<AwContentsUserData*>( 99 AwContentsUserData* data = reinterpret_cast<AwContentsUserData*>(
100 web_contents->GetUserData(kAwContentsUserDataKey)); 100 web_contents->GetUserData(kAwContentsUserDataKey));
101 return data ? data->contents_ : NULL; 101 return data ? data->contents_ : NULL;
102 } 102 }
103 103
104 private: 104 private:
105 AwContents* contents_; 105 AwContents* contents_;
106 }; 106 };
107 107
108 // Work-around for http://crbug.com/161864. TODO(joth): Remove this class when
109 // that bug is closed.
110 class NullCompositor : public content::Compositor {
111 public:
112 NullCompositor() {}
113 virtual ~NullCompositor() {}
114
115 // Compositor
116 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) OVERRIDE {}
117 virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE {}
118 virtual void SetVisible(bool visible) OVERRIDE {}
119 virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE {}
120 virtual bool CompositeAndReadback(void *pixels, const gfx::Rect& rect)
121 OVERRIDE {
122 return false;
123 }
124 virtual void Composite() {}
125 virtual WebKit::WebGLId GenerateTexture(gfx::JavaBitmap& bitmap) OVERRIDE {
126 return 0;
127 }
128 virtual WebKit::WebGLId GenerateCompressedTexture(gfx::Size& size,
129 int data_size,
130 void* data) OVERRIDE {
131 return 0;
132 }
133 virtual void DeleteTexture(WebKit::WebGLId texture_id) OVERRIDE {}
134 virtual bool CopyTextureToBitmap(WebKit::WebGLId texture_id,
135 gfx::JavaBitmap& bitmap) OVERRIDE {
136 return false;
137 }
138 virtual bool CopyTextureToBitmap(WebKit::WebGLId texture_id,
139 const gfx::Rect& src_rect,
140 gfx::JavaBitmap& bitmap) OVERRIDE {
141 return false;
142 }
143 virtual void SetHasTransparentBackground(bool flag) OVERRIDE {}
144 };
145
146 } // namespace 108 } // namespace
147 109
148 // static 110 // static
149 AwContents* AwContents::FromWebContents(WebContents* web_contents) { 111 AwContents* AwContents::FromWebContents(WebContents* web_contents) {
150 return AwContentsUserData::GetContents(web_contents); 112 return AwContentsUserData::GetContents(web_contents);
151 } 113 }
152 114
153 AwContents::AwContents(JNIEnv* env, 115 AwContents::AwContents(JNIEnv* env,
154 jobject obj, 116 jobject obj,
155 jobject web_contents_delegate, 117 jobject web_contents_delegate,
(...skipping 10 matching lines...) Expand all
166 android_webview::AwBrowserDependencyFactory* dependency_factory = 128 android_webview::AwBrowserDependencyFactory* dependency_factory =
167 android_webview::AwBrowserDependencyFactory::GetInstance(); 129 android_webview::AwBrowserDependencyFactory::GetInstance();
168 130
169 // TODO(joth): rather than create and set the WebContents here, expose the 131 // TODO(joth): rather than create and set the WebContents here, expose the
170 // factory method to java side and have that orchestrate the construction 132 // factory method to java side and have that orchestrate the construction
171 // order. 133 // order.
172 SetWebContents(dependency_factory->CreateWebContents(private_browsing)); 134 SetWebContents(dependency_factory->CreateWebContents(private_browsing));
173 } 135 }
174 136
175 void AwContents::ResetCompositor() { 137 void AwContents::ResetCompositor() {
176 if (UseCompositorDirectDraw()) { 138 compositor_.reset(content::Compositor::Create(this));
177 compositor_.reset(content::Compositor::Create(this)); 139 if (scissor_clip_layer_.get())
178 if (scissor_clip_layer_.get()) 140 AttachLayerTree();
179 AttachLayerTree();
180 } else {
181 LOG(WARNING) << "Running on unsupported device: using null Compositor";
182 compositor_.reset(new NullCompositor);
183 }
184 } 141 }
185 142
186 void AwContents::SetWebContents(content::WebContents* web_contents) { 143 void AwContents::SetWebContents(content::WebContents* web_contents) {
187 web_contents_.reset(web_contents); 144 web_contents_.reset(web_contents);
188 web_contents_->SetUserData(kAwContentsUserDataKey, 145 web_contents_->SetUserData(kAwContentsUserDataKey,
189 new AwContentsUserData(this)); 146 new AwContentsUserData(this));
190 147
191 web_contents_->SetDelegate(web_contents_delegate_.get()); 148 web_contents_->SetDelegate(web_contents_delegate_.get());
192 render_view_host_ext_.reset(new AwRenderViewHostExt(web_contents_.get(), 149 render_view_host_ext_.reset(new AwRenderViewHostExt(web_contents_.get(),
193 this)); 150 this));
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 843
887 void AwContents::OnPictureUpdated(int process_id, int render_view_id) { 844 void AwContents::OnPictureUpdated(int process_id, int render_view_id) {
888 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id); 845 CHECK_EQ(web_contents_->GetRenderProcessHost()->GetID(), process_id);
889 if (render_view_id != web_contents_->GetRoutingID()) 846 if (render_view_id != web_contents_->GetRoutingID())
890 return; 847 return;
891 848
892 Invalidate(); 849 Invalidate();
893 } 850 }
894 851
895 } // namespace android_webview 852 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698