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

Side by Side Diff: third_party/WebKit/public/platform/Platform.h

Issue 2846843002: [blink] Unique pointers in Platform.h (Closed)
Patch Set: fix compilation (and again) Created 3 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 class WebCanvasCaptureHandler; 86 class WebCanvasCaptureHandler;
87 class WebClipboard; 87 class WebClipboard;
88 class WebCompositorSupport; 88 class WebCompositorSupport;
89 class WebCookieJar; 89 class WebCookieJar;
90 class WebCrypto; 90 class WebCrypto;
91 class WebDatabaseObserver; 91 class WebDatabaseObserver;
92 class WebPlatformEventListener; 92 class WebPlatformEventListener;
93 class WebFallbackThemeEngine; 93 class WebFallbackThemeEngine;
94 class WebFileSystem; 94 class WebFileSystem;
95 class WebFileUtilities; 95 class WebFileUtilities;
96 class WebFlingAnimator;
97 class WebGestureCurve; 96 class WebGestureCurve;
98 class WebGraphicsContext3DProvider; 97 class WebGraphicsContext3DProvider;
99 class WebIDBFactory; 98 class WebIDBFactory;
100 class WebImageCaptureFrameGrabber; 99 class WebImageCaptureFrameGrabber;
101 class WebMIDIAccessor; 100 class WebMIDIAccessor;
102 class WebMIDIAccessorClient; 101 class WebMIDIAccessorClient;
103 class WebMediaCapabilitiesClient; 102 class WebMediaCapabilitiesClient;
104 class WebMediaPlayer; 103 class WebMediaPlayer;
105 class WebMediaRecorderHandler; 104 class WebMediaRecorderHandler;
106 class WebMediaStream; 105 class WebMediaStream;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 161
163 // May return null if sandbox support is not necessary 162 // May return null if sandbox support is not necessary
164 virtual WebSandboxSupport* GetSandboxSupport() { return nullptr; } 163 virtual WebSandboxSupport* GetSandboxSupport() { return nullptr; }
165 164
166 // May return null on some platforms. 165 // May return null on some platforms.
167 virtual WebThemeEngine* ThemeEngine() { return nullptr; } 166 virtual WebThemeEngine* ThemeEngine() { return nullptr; }
168 167
169 virtual WebFallbackThemeEngine* FallbackThemeEngine() { return nullptr; } 168 virtual WebFallbackThemeEngine* FallbackThemeEngine() { return nullptr; }
170 169
171 // May return null. 170 // May return null.
172 virtual WebSpeechSynthesizer* CreateSpeechSynthesizer( 171 virtual std::unique_ptr<WebSpeechSynthesizer> CreateSpeechSynthesizer(
173 WebSpeechSynthesizerClient*) { 172 WebSpeechSynthesizerClient*) {
174 return nullptr; 173 return nullptr;
175 } 174 }
176 175
177 // Audio -------------------------------------------------------------- 176 // Audio --------------------------------------------------------------
178 177
179 virtual double AudioHardwareSampleRate() { return 0; } 178 virtual double AudioHardwareSampleRate() { return 0; }
180 virtual size_t AudioHardwareBufferSize() { return 0; } 179 virtual size_t AudioHardwareBufferSize() { return 0; }
181 virtual unsigned AudioHardwareOutputChannels() { return 0; } 180 virtual unsigned AudioHardwareOutputChannels() { return 0; }
182 181
183 // Creates a device for audio I/O. 182 // Creates a device for audio I/O.
184 // Pass in (numberOfInputChannels > 0) if live/local audio input is desired. 183 // Pass in (numberOfInputChannels > 0) if live/local audio input is desired.
185 virtual WebAudioDevice* CreateAudioDevice( 184 virtual std::unique_ptr<WebAudioDevice> CreateAudioDevice(
186 unsigned number_of_input_channels, 185 unsigned number_of_input_channels,
187 unsigned number_of_channels, 186 unsigned number_of_channels,
188 const WebAudioLatencyHint& latency_hint, 187 const WebAudioLatencyHint& latency_hint,
189 WebAudioDevice::RenderCallback*, 188 WebAudioDevice::RenderCallback*,
190 const WebString& device_id, 189 const WebString& device_id,
191 const WebSecurityOrigin&) { 190 const WebSecurityOrigin&) {
192 return nullptr; 191 return nullptr;
193 } 192 }
194 193
195 // MIDI ---------------------------------------------------------------- 194 // MIDI ----------------------------------------------------------------
196 195
197 // Creates a platform dependent WebMIDIAccessor. MIDIAccessor under platform 196 // Creates a platform dependent WebMIDIAccessor. MIDIAccessor under platform
198 // creates and owns it. 197 // creates and owns it.
199 virtual WebMIDIAccessor* CreateMIDIAccessor(WebMIDIAccessorClient*) { 198 virtual std::unique_ptr<WebMIDIAccessor> CreateMIDIAccessor(
200 return nullptr; 199 WebMIDIAccessorClient*);
201 }
202 200
203 // Blob ---------------------------------------------------------------- 201 // Blob ----------------------------------------------------------------
204 202
205 // Must return non-null. 203 // Must return non-null.
206 virtual WebBlobRegistry* GetBlobRegistry() { return nullptr; } 204 virtual WebBlobRegistry* GetBlobRegistry() { return nullptr; }
207 205
208 // Database ------------------------------------------------------------ 206 // Database ------------------------------------------------------------
209 207
210 // Opens a database file; dirHandle should be 0 if the caller does not need 208 // Opens a database file; dirHandle should be 0 if the caller does not need
211 // a handle to the directory containing this file 209 // a handle to the directory containing this file
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 242
245 // Return a filename-friendly identifier for an origin. 243 // Return a filename-friendly identifier for an origin.
246 virtual WebString DatabaseCreateOriginIdentifier( 244 virtual WebString DatabaseCreateOriginIdentifier(
247 const WebSecurityOrigin& origin) { 245 const WebSecurityOrigin& origin) {
248 return WebString(); 246 return WebString();
249 } 247 }
250 248
251 // DOM Storage -------------------------------------------------- 249 // DOM Storage --------------------------------------------------
252 250
253 // Return a LocalStorage namespace 251 // Return a LocalStorage namespace
254 virtual WebStorageNamespace* CreateLocalStorageNamespace() { return nullptr; } 252 virtual std::unique_ptr<WebStorageNamespace> CreateLocalStorageNamespace();
255 253
256 // FileSystem ---------------------------------------------------------- 254 // FileSystem ----------------------------------------------------------
257 255
258 // Must return non-null. 256 // Must return non-null.
259 virtual WebFileSystem* FileSystem() { return nullptr; } 257 virtual WebFileSystem* FileSystem() { return nullptr; }
260 258
261 // Return a filename-friendly identifier for an origin. 259 // Return a filename-friendly identifier for an origin.
262 virtual WebString FileSystemCreateOriginIdentifier( 260 virtual WebString FileSystemCreateOriginIdentifier(
263 const WebSecurityOrigin& origin) { 261 const WebSecurityOrigin& origin) {
264 return WebString(); 262 return WebString();
265 } 263 }
266 264
267 // IDN conversion ------------------------------------------------------ 265 // IDN conversion ------------------------------------------------------
268 266
269 virtual WebString ConvertIDNToUnicode(const WebString& host) { return host; } 267 virtual WebString ConvertIDNToUnicode(const WebString& host) { return host; }
270 268
271 // IndexedDB ---------------------------------------------------------- 269 // IndexedDB ----------------------------------------------------------
272 270
273 // Must return non-null. 271 // Must return non-null.
274 virtual WebIDBFactory* IdbFactory() { return nullptr; } 272 virtual WebIDBFactory* IdbFactory() { return nullptr; }
275 273
276 // Cache Storage ---------------------------------------------------------- 274 // Cache Storage ----------------------------------------------------------
277 275
278 // The caller is responsible for deleting the returned object. 276 virtual std::unique_ptr<WebServiceWorkerCacheStorage> CreateCacheStorage(
279 virtual WebServiceWorkerCacheStorage* CacheStorage(const WebSecurityOrigin&) { 277 const WebSecurityOrigin&);
280 return nullptr;
281 }
282 278
283 // Gamepad ------------------------------------------------------------- 279 // Gamepad -------------------------------------------------------------
284 280
285 virtual void SampleGamepads(device::Gamepads& into) {} 281 virtual void SampleGamepads(device::Gamepads& into) {}
286 282
287 // History ------------------------------------------------------------- 283 // History -------------------------------------------------------------
288 284
289 // Returns the hash for the given canonicalized URL for use in visited 285 // Returns the hash for the given canonicalized URL for use in visited
290 // link coloring. 286 // link coloring.
291 virtual unsigned long long VisitedLinkHash(const char* canonical_url, 287 virtual unsigned long long VisitedLinkHash(const char* canonical_url,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 383 }
388 virtual WebString QueryLocalizedString(WebLocalizedString::Name, 384 virtual WebString QueryLocalizedString(WebLocalizedString::Name,
389 const WebString& parameter1, 385 const WebString& parameter1,
390 const WebString& parameter2) { 386 const WebString& parameter2) {
391 return WebString(); 387 return WebString();
392 } 388 }
393 389
394 // Threads ------------------------------------------------------- 390 // Threads -------------------------------------------------------
395 391
396 // Creates an embedder-defined thread. 392 // Creates an embedder-defined thread.
397 virtual WebThread* CreateThread(const char* name) { return nullptr; } 393 virtual std::unique_ptr<WebThread> CreateThread(const char* name);
398 394
399 // Returns an interface to the current thread. This is owned by the 395 // Returns an interface to the current thread. This is owned by the
400 // embedder. 396 // embedder.
401 virtual WebThread* CurrentThread() { return nullptr; } 397 virtual WebThread* CurrentThread() { return nullptr; }
402 398
403 // Returns a blame context for attributing top-level work which does not 399 // Returns a blame context for attributing top-level work which does not
404 // belong to a particular frame scope. 400 // belong to a particular frame scope.
405 virtual BlameContext* GetTopLevelBlameContext() { return nullptr; } 401 virtual BlameContext* GetTopLevelBlameContext() { return nullptr; }
406 402
407 // Resources ----------------------------------------------------------- 403 // Resources -----------------------------------------------------------
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 WebString vendor_info; 485 WebString vendor_info;
490 WebString renderer_info; 486 WebString renderer_info;
491 WebString driver_version; 487 WebString driver_version;
492 WebString error_message; 488 WebString error_message;
493 }; 489 };
494 // Returns a newly allocated and initialized offscreen context provider, 490 // Returns a newly allocated and initialized offscreen context provider,
495 // backed by an independent context. Returns null if the context cannot be 491 // backed by an independent context. Returns null if the context cannot be
496 // created or initialized. 492 // created or initialized.
497 // Passing an existing provider to shareContext will create the new context 493 // Passing an existing provider to shareContext will create the new context
498 // in the same share group as the one passed. 494 // in the same share group as the one passed.
499 virtual WebGraphicsContext3DProvider* 495 virtual std::unique_ptr<WebGraphicsContext3DProvider>
500 CreateOffscreenGraphicsContext3DProvider( 496 CreateOffscreenGraphicsContext3DProvider(
501 const ContextAttributes&, 497 const ContextAttributes&,
502 const WebURL& top_document_url, 498 const WebURL& top_document_url,
503 WebGraphicsContext3DProvider* share_context, 499 WebGraphicsContext3DProvider* share_context,
504 GraphicsInfo*) { 500 GraphicsInfo*);
505 return nullptr;
506 }
507 501
508 // Returns a newly allocated and initialized offscreen context provider, 502 // Returns a newly allocated and initialized offscreen context provider,
509 // backed by the process-wide shared main thread context. Returns null if 503 // backed by the process-wide shared main thread context. Returns null if
510 // the context cannot be created or initialized. 504 // the context cannot be created or initialized.
511 virtual WebGraphicsContext3DProvider* 505 virtual std::unique_ptr<WebGraphicsContext3DProvider>
512 CreateSharedOffscreenGraphicsContext3DProvider() { 506 CreateSharedOffscreenGraphicsContext3DProvider();
513 return nullptr;
514 }
515 507
516 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() { 508 virtual gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() {
517 return nullptr; 509 return nullptr;
518 } 510 }
519 511
520 virtual std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmap( 512 virtual std::unique_ptr<cc::SharedBitmap> AllocateSharedBitmap(
521 const WebSize& size) { 513 const WebSize& size) {
522 return nullptr; 514 return nullptr;
523 } 515 }
524 516
525 virtual bool IsThreadedCompositingEnabled() { return false; } 517 virtual bool IsThreadedCompositingEnabled() { return false; }
526 virtual bool IsThreadedAnimationEnabled() { return true; } 518 virtual bool IsThreadedAnimationEnabled() { return true; }
527 519
528 virtual WebCompositorSupport* CompositorSupport() { return nullptr; } 520 virtual WebCompositorSupport* CompositorSupport() { return nullptr; }
529 521
530 virtual WebFlingAnimator* CreateFlingAnimator() { return nullptr; }
531
532 // Creates a new fling animation curve instance for device |deviceSource| 522 // Creates a new fling animation curve instance for device |deviceSource|
533 // with |velocity| and already scrolled |cumulativeScroll| pixels. 523 // with |velocity| and already scrolled |cumulativeScroll| pixels.
534 virtual WebGestureCurve* CreateFlingAnimationCurve( 524 virtual std::unique_ptr<WebGestureCurve> CreateFlingAnimationCurve(
535 WebGestureDevice device_source, 525 WebGestureDevice device_source,
536 const WebFloatPoint& velocity, 526 const WebFloatPoint& velocity,
537 const WebSize& cumulative_scroll) { 527 const WebSize& cumulative_scroll);
538 return nullptr;
539 }
540 528
541 // Whether the command line flag: --disable-gpu-compositing or --disable-gpu 529 // Whether the command line flag: --disable-gpu-compositing or --disable-gpu
542 // exists or not 530 // exists or not
543 // NOTE: This function should not be called from core/ and modules/, but 531 // NOTE: This function should not be called from core/ and modules/, but
544 // called by platform/graphics/ is fine. 532 // called by platform/graphics/ is fine.
545 virtual bool IsGPUCompositingEnabled() { return true; } 533 virtual bool IsGPUCompositingEnabled() { return true; }
546 534
547 // WebRTC ---------------------------------------------------------- 535 // WebRTC ----------------------------------------------------------
548 536
549 // Creates a WebRTCPeerConnectionHandler for RTCPeerConnection. 537 // Creates a WebRTCPeerConnectionHandler for RTCPeerConnection.
550 // May return null if WebRTC functionality is not avaliable or if it's out of 538 // May return null if WebRTC functionality is not avaliable or if it's out of
551 // resources. 539 // resources.
552 virtual WebRTCPeerConnectionHandler* CreateRTCPeerConnectionHandler( 540 virtual std::unique_ptr<WebRTCPeerConnectionHandler>
553 WebRTCPeerConnectionHandlerClient*) { 541 CreateRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient*);
554 return nullptr;
555 }
556 542
557 // Creates a WebMediaRecorderHandler to record MediaStreams. 543 // Creates a WebMediaRecorderHandler to record MediaStreams.
558 // May return null if the functionality is not available or out of resources. 544 // May return null if the functionality is not available or out of resources.
559 virtual WebMediaRecorderHandler* CreateMediaRecorderHandler() { 545 virtual std::unique_ptr<WebMediaRecorderHandler> CreateMediaRecorderHandler();
560 return nullptr;
561 }
562 546
563 // May return null if WebRTC functionality is not available or out of 547 // May return null if WebRTC functionality is not available or out of
564 // resources. 548 // resources.
565 virtual WebRTCCertificateGenerator* CreateRTCCertificateGenerator() { 549 virtual std::unique_ptr<WebRTCCertificateGenerator>
566 return nullptr; 550 CreateRTCCertificateGenerator();
567 }
568 551
569 // May return null if WebRTC functionality is not available or out of 552 // May return null if WebRTC functionality is not available or out of
570 // resources. 553 // resources.
571 virtual WebMediaStreamCenter* CreateMediaStreamCenter( 554 virtual std::unique_ptr<WebMediaStreamCenter> CreateMediaStreamCenter(
572 WebMediaStreamCenterClient*) { 555 WebMediaStreamCenterClient*);
573 return nullptr;
574 }
575 556
576 // Creates a WebCanvasCaptureHandler to capture Canvas output. 557 // Creates a WebCanvasCaptureHandler to capture Canvas output.
577 virtual WebCanvasCaptureHandler* 558 virtual std::unique_ptr<WebCanvasCaptureHandler>
578 CreateCanvasCaptureHandler(const WebSize&, double, WebMediaStreamTrack*) { 559 CreateCanvasCaptureHandler(const WebSize&, double, WebMediaStreamTrack*);
579 return nullptr;
580 }
581 560
582 // Fills in the WebMediaStream to capture from the WebMediaPlayer identified 561 // Fills in the WebMediaStream to capture from the WebMediaPlayer identified
583 // by the second parameter. 562 // by the second parameter.
584 virtual void CreateHTMLVideoElementCapturer(WebMediaStream*, 563 virtual void CreateHTMLVideoElementCapturer(WebMediaStream*,
585 WebMediaPlayer*) {} 564 WebMediaPlayer*) {}
586 virtual void CreateHTMLAudioElementCapturer(WebMediaStream*, 565 virtual void CreateHTMLAudioElementCapturer(WebMediaStream*,
587 WebMediaPlayer*) {} 566 WebMediaPlayer*) {}
588 567
589 // Creates a WebImageCaptureFrameGrabber to take a snapshot of a Video Tracks. 568 // Creates a WebImageCaptureFrameGrabber to take a snapshot of a Video Tracks.
590 // May return null if the functionality is not available. 569 // May return null if the functionality is not available.
591 virtual WebImageCaptureFrameGrabber* CreateImageCaptureFrameGrabber() { 570 virtual std::unique_ptr<WebImageCaptureFrameGrabber>
592 return nullptr; 571 CreateImageCaptureFrameGrabber();
593 }
594 572
595 // WebWorker ---------------------------------------------------------- 573 // WebWorker ----------------------------------------------------------
596 574
597 virtual void DidStartWorkerThread() {} 575 virtual void DidStartWorkerThread() {}
598 virtual void WillStopWorkerThread() {} 576 virtual void WillStopWorkerThread() {}
599 virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {} 577 virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
600 virtual bool AllowScriptExtensionForServiceWorker(const WebURL& script_url) { 578 virtual bool AllowScriptExtensionForServiceWorker(const WebURL& script_url) {
601 return false; 579 return false;
602 } 580 }
603 581
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // Requests purging memory. The platform may or may not purge memory, 668 // Requests purging memory. The platform may or may not purge memory,
691 // depending on memory pressure. 669 // depending on memory pressure.
692 virtual void RequestPurgeMemory() {} 670 virtual void RequestPurgeMemory() {}
693 671
694 // Feature Policy ----------------------------------------------------- 672 // Feature Policy -----------------------------------------------------
695 673
696 // Create a new feature policy object for a document, given its parent 674 // Create a new feature policy object for a document, given its parent
697 // document's policy (may be nullptr), its container policy (may be empty), 675 // document's policy (may be nullptr), its container policy (may be empty),
698 // the header policy with which it was delivered (may be empty), and the 676 // the header policy with which it was delivered (may be empty), and the
699 // document's origin. 677 // document's origin.
700 virtual WebFeaturePolicy* CreateFeaturePolicy( 678 virtual std::unique_ptr<WebFeaturePolicy> CreateFeaturePolicy(
701 const WebFeaturePolicy* parent_policy, 679 const WebFeaturePolicy* parent_policy,
702 const WebParsedFeaturePolicy& container_policy, 680 const WebParsedFeaturePolicy& container_policy,
703 const WebParsedFeaturePolicy& policy_header, 681 const WebParsedFeaturePolicy& policy_header,
704 const WebSecurityOrigin&) { 682 const WebSecurityOrigin&);
705 return nullptr;
706 }
707 683
708 // Create a new feature policy for a document whose origin has changed, given 684 // Create a new feature policy for a document whose origin has changed, given
709 // the previous policy object and the new origin. 685 // the previous policy object and the new origin.
710 virtual WebFeaturePolicy* DuplicateFeaturePolicyWithOrigin( 686 virtual std::unique_ptr<WebFeaturePolicy> DuplicateFeaturePolicyWithOrigin(
711 const WebFeaturePolicy&, 687 const WebFeaturePolicy&,
712 const WebSecurityOrigin&) { 688 const WebSecurityOrigin&);
713 return nullptr;
714 }
715 689
716 protected: 690 protected:
717 Platform(); 691 Platform();
718 virtual ~Platform() {} 692 virtual ~Platform() {}
719 693
720 WebThread* main_thread_; 694 WebThread* main_thread_;
721 }; 695 };
722 696
723 } // namespace blink 697 } // namespace blink
724 698
725 #endif 699 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/public/BUILD.gn ('k') | third_party/WebKit/public/platform/WebFlingAnimator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698