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

Side by Side Diff: components/html_viewer/blink_platform_impl.cc

Issue 1343303003: Revert of Mandoline: Add WebGL support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « components/html_viewer/blink_platform_impl.h ('k') | components/html_viewer/html_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/html_viewer/blink_platform_impl.h" 5 #include "components/html_viewer/blink_platform_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/threading/platform_thread.h" 14 #include "base/threading/platform_thread.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "base/trace_event/trace_event.h" 16 #include "base/trace_event/trace_event.h"
17 #include "components/html_viewer/blink_resource_constants.h" 17 #include "components/html_viewer/blink_resource_constants.h"
18 #include "components/html_viewer/web_clipboard_impl.h" 18 #include "components/html_viewer/web_clipboard_impl.h"
19 #include "components/html_viewer/web_cookie_jar_impl.h" 19 #include "components/html_viewer/web_cookie_jar_impl.h"
20 #include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h"
21 #include "components/html_viewer/web_socket_handle_impl.h" 20 #include "components/html_viewer/web_socket_handle_impl.h"
22 #include "components/html_viewer/web_url_loader_impl.h" 21 #include "components/html_viewer/web_url_loader_impl.h"
23 #include "components/message_port/web_message_port_channel_impl.h" 22 #include "components/message_port/web_message_port_channel_impl.h"
24 #include "components/mime_util/mime_util.h" 23 #include "components/mime_util/mime_util.h"
25 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" 24 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h"
26 #include "components/scheduler/renderer/renderer_scheduler.h" 25 #include "components/scheduler/renderer/renderer_scheduler.h"
27 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" 26 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h"
28 #include "mojo/application/public/cpp/application_impl.h" 27 #include "mojo/application/public/cpp/application_impl.h"
29 #include "mojo/application/public/cpp/connect.h" 28 #include "mojo/application/public/cpp/connect.h"
30 #include "mojo/common/user_agent.h" 29 #include "mojo/common/user_agent.h"
31 #include "net/base/data_url.h" 30 #include "net/base/data_url.h"
32 #include "net/base/ip_address_number.h" 31 #include "net/base/ip_address_number.h"
33 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
34 #include "net/base/net_util.h" 33 #include "net/base/net_util.h"
35 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" 34 #include "third_party/WebKit/public/platform/WebWaitableEvent.h"
36 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
37 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" 36 #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
38 #include "url/gurl.h"
39 37
40 namespace html_viewer { 38 namespace html_viewer {
41 namespace { 39 namespace {
42 40
43 // Allows overriding user agent scring. 41 // Allows overriding user agent scring.
44 const char kUserAgentSwitch[] = "user-agent"; 42 const char kUserAgentSwitch[] = "user-agent";
45 43
46 class WebWaitableEventImpl : public blink::WebWaitableEvent { 44 class WebWaitableEventImpl : public blink::WebWaitableEvent {
47 public: 45 public:
48 WebWaitableEventImpl(ResetPolicy policy, InitialState state) { 46 WebWaitableEventImpl(ResetPolicy policy, InitialState state) {
(...skipping 14 matching lines...) Expand all
63 private: 61 private:
64 scoped_ptr<base::WaitableEvent> impl_; 62 scoped_ptr<base::WaitableEvent> impl_;
65 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl); 63 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl);
66 }; 64 };
67 65
68 } // namespace 66 } // namespace
69 67
70 BlinkPlatformImpl::BlinkPlatformImpl( 68 BlinkPlatformImpl::BlinkPlatformImpl(
71 mojo::ApplicationImpl* app, 69 mojo::ApplicationImpl* app,
72 scheduler::RendererScheduler* renderer_scheduler) 70 scheduler::RendererScheduler* renderer_scheduler)
73 : app_(app), 71 : main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()),
74 main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()),
75 main_thread_(new scheduler::WebThreadImplForRendererScheduler( 72 main_thread_(new scheduler::WebThreadImplForRendererScheduler(
76 renderer_scheduler)) { 73 renderer_scheduler)) {
77 if (app) { 74 if (app) {
78 mojo::URLRequestPtr request(mojo::URLRequest::New()); 75 mojo::URLRequestPtr request(mojo::URLRequest::New());
79 request->url = mojo::String::From("mojo:network_service"); 76 request->url = mojo::String::From("mojo:network_service");
80 scoped_ptr<mojo::ApplicationConnection> connection = 77 scoped_ptr<mojo::ApplicationConnection> connection =
81 app->ConnectToApplication(request.Pass()); 78 app->ConnectToApplication(request.Pass());
82 connection->ConnectToService(&web_socket_factory_); 79 connection->ConnectToService(&web_socket_factory_);
83 connection->ConnectToService(&url_loader_factory_); 80 connection->ConnectToService(&url_loader_factory_);
84 81
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 blink::WebScrollbarBehavior* BlinkPlatformImpl::scrollbarBehavior() { 155 blink::WebScrollbarBehavior* BlinkPlatformImpl::scrollbarBehavior() {
159 return &scrollbar_behavior_; 156 return &scrollbar_behavior_;
160 } 157 }
161 158
162 const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag( 159 const unsigned char* BlinkPlatformImpl::getTraceCategoryEnabledFlag(
163 const char* category_name) { 160 const char* category_name) {
164 static const unsigned char buf[] = "*"; 161 static const unsigned char buf[] = "*";
165 return buf; 162 return buf;
166 } 163 }
167 164
168 blink::WebGraphicsContext3D*
169 BlinkPlatformImpl::createOffscreenGraphicsContext3D(
170 const blink::WebGraphicsContext3D::Attributes& attributes,
171 blink::WebGraphicsContext3D* share_context) {
172 return createOffscreenGraphicsContext3D(attributes, share_context, nullptr);
173 }
174
175 blink::WebGraphicsContext3D*
176 BlinkPlatformImpl::createOffscreenGraphicsContext3D(
177 const blink::WebGraphicsContext3D::Attributes& attributes,
178 blink::WebGraphicsContext3D* share_context,
179 blink::WebGLInfo* gl_info) {
180 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
181 app_, GURL(attributes.topDocumentURL), attributes, share_context,
182 gl_info);
183 }
184
185 blink::WebGraphicsContext3D*
186 BlinkPlatformImpl::createOffscreenGraphicsContext3D(
187 const blink::WebGraphicsContext3D::Attributes& attributes) {
188 return createOffscreenGraphicsContext3D(attributes, nullptr, nullptr);
189 }
190
191 blink::WebGraphicsContext3DProvider*
192 BlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() {
193 return nullptr;
194 }
195
196 blink::WebData BlinkPlatformImpl::loadResource(const char* resource) { 165 blink::WebData BlinkPlatformImpl::loadResource(const char* resource) {
197 for (size_t i = 0; i < arraysize(kDataResources); ++i) { 166 for (size_t i = 0; i < arraysize(kDataResources); ++i) {
198 if (!strcmp(resource, kDataResources[i].name)) { 167 if (!strcmp(resource, kDataResources[i].name)) {
199 base::StringPiece data = 168 base::StringPiece data =
200 ResourceBundle::GetSharedInstance().GetRawDataResourceForScale( 169 ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
201 kDataResources[i].id, ui::SCALE_FACTOR_100P); 170 kDataResources[i].id, ui::SCALE_FACTOR_100P);
202 return blink::WebData(data.data(), data.size()); 171 return blink::WebData(data.data(), data.size());
203 } 172 }
204 } 173 }
205 NOTREACHED() << "Requested resource is unavailable: " << resource; 174 NOTREACHED() << "Requested resource is unavailable: " << resource;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 BlinkPlatformImpl::notificationManager() { 280 BlinkPlatformImpl::notificationManager() {
312 return &web_notification_manager_; 281 return &web_notification_manager_;
313 } 282 }
314 283
315 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { 284 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) {
316 DCHECK(!current_thread_slot_.Get()); 285 DCHECK(!current_thread_slot_.Get());
317 current_thread_slot_.Set(thread); 286 current_thread_slot_.Set(thread);
318 } 287 }
319 288
320 } // namespace html_viewer 289 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/blink_platform_impl.h ('k') | components/html_viewer/html_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698