Teach SkyView code path to print hello, world

This CL makes the SkyView codepath smart enough to print "hello, world" to the
console. The code path is off by default but can be enabled by changing one
line of code.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1131673011
This commit is contained in:
Adam Barth
2015-05-19 13:51:12 -07:00
parent 826623c1f1
commit 44c10c9f6b
2 changed files with 18 additions and 3 deletions

View File

@@ -70,8 +70,10 @@ void Engine::BeginFrame(base::TimeTicks frame_time) {
double interval_sec = 1.0 / 60;
blink::WebBeginFrameArgs args(frame_time_sec, deadline_sec, interval_sec);
web_view_->beginFrame(args);
web_view_->layout();
if (web_view_) {
web_view_->beginFrame(args);
web_view_->layout();
}
}
skia::RefPtr<SkPicture> Engine::Paint() {
@@ -83,7 +85,9 @@ skia::RefPtr<SkPicture> Engine::Paint() {
physical_size_.width(), physical_size_.height(), &factory,
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag));
web_view_->paint(canvas.get(), blink::WebRect(gfx::Rect(physical_size_)));
if (web_view_)
web_view_->paint(canvas.get(), blink::WebRect(gfx::Rect(physical_size_)));
return skia::AdoptRef(recorder.endRecordingAsPicture());
}
@@ -143,6 +147,13 @@ void Engine::OnInputEvent(InputEventPtr event) {
}
void Engine::LoadURL(const mojo::String& url) {
// Enable SkyView here.
if (false) {
sky_view_ = blink::SkyView::Create();
sky_view_->Load(GURL(url));
return;
}
// Something bad happens if you try to call WebView::close and replace
// the webview. So for now we just load into the existing one. :/
if (!web_view_)

View File

@@ -15,6 +15,7 @@
#include "mojo/services/navigation/public/interfaces/navigation.mojom.h"
#include "skia/ext/refptr.h"
#include "sky/engine/public/platform/ServiceProvider.h"
#include "sky/engine/public/sky/sky_view.h"
#include "sky/engine/public/web/WebFrameClient.h"
#include "sky/engine/public/web/WebViewClient.h"
#include "sky/shell/gpu_delegate.h"
@@ -89,7 +90,10 @@ class Engine : public UIDelegate,
mojo::ServiceProviderPtr service_provider_;
scoped_ptr<PlatformImpl> platform_impl_;
scoped_ptr<Animator> animator_;
std::unique_ptr<blink::SkyView> sky_view_;
blink::WebView* web_view_;
float device_pixel_ratio_;
gfx::Size physical_size_;
mojo::Binding<ViewportObserver> viewport_observer_binding_;